A full-stack accounting system built as a monorepo using Turborepo, Next.js, NestJS, and Prisma.
apps/
- Frontend applicationsweb/
- Next.js web application
packages/
- Shared packagesshared-types/
- TypeScript types and interfacesui-components/
- Reusable UI componentsapi-client/
- API clients for backend services
services/
- Backend microservicesapi-gateway/
- API Gateway serviceauth/
- Authentication servicegeneral-ledger/
- General Ledger serviceaccounts-receivable/
- Accounts Receivable serviceaccounts-payable/
- Accounts Payable serviceinventory/
- Inventory Management servicefixed-assets/
- Fixed Assets servicebanking/
- Banking service
- Node.js 18+
- Yarn
- Docker (for development and deployment)
- PostgreSQL (for development and production)
-
Clone the repository
git clone https://github.com/your-org/qbit-accounting.git cd qbit-accounting
-
Install dependencies
yarn install
-
Start the development server
yarn dev
Each package and app can be developed independently or together. Run the following commands from the root directory:
yarn build
- Build all packages and appsyarn dev
- Start all development serversyarn lint
- Lint all packages and apps
We have successfully implemented the inventory stock management UI with the following components:
-
API Client Integration:
- Created an inventory API client to interact with the inventory service
- Implemented methods for fetching inventory levels, transactions, and warehouse data
-
UI Components:
- StockLevelList: Displays inventory levels with filtering and sorting
- TransactionList: Shows inventory transactions with actions like edit, view, process, and delete
- TransactionForm: Allows creating and editing inventory transactions
- WarehouseSelector: Component for selecting warehouses to filter inventory data
-
Pages:
- Main inventory page showing stock levels across warehouses
- Transactions list page for viewing and managing inventory movements
- New transaction page for creating inventory transactions
These components provide a complete interface for managing inventory stock, tracking movements, and making inventory adjustments. The UI integrates with the previously built inventory transaction API and provides a user-friendly way to manage product stock levels across multiple warehouses.
When deploying to Kubernetes, you need to properly substitute environment variables in the manifest files. We provide scripts to handle this:
# Make the script executable
chmod +x scripts/substitute-env.sh
# Run with your Docker registry username
./scripts/substitute-env.sh yourusername
# Apply the processed manifests
kubectl apply -f processed-k8s/
# Run with your Docker registry username
.\scripts\substitute-env.ps1 yourusername
# Apply the processed manifests
kubectl apply -f processed-k8s/
This will replace ${DOCKER_REGISTRY}
with your actual Docker registry username in all Kubernetes manifests and save the processed files in the processed-k8s
directory.
The GitHub Actions workflow will automatically handle environment variable substitution during deployment:
- It replaces
${DOCKER_REGISTRY}
with the Docker Hub username stored in GitHub Secrets - Processes all Kubernetes manifests before applying them
- Applies the processed manifests to the Kubernetes cluster
The Qbit Accounting System uses Prisma ORM for database migrations across all microservices. Each service has its own database schema and migration history.
We provide scripts to run migrations for all services:
# Make the script executable
chmod +x scripts/run-migrations.sh
# Run migrations for development environment
./scripts/run-migrations.sh
# Or for a specific environment
./scripts/run-migrations.sh production
# Run migrations for development environment
.\scripts\run-migrations.ps1
# Or for a specific environment
.\scripts\run-migrations.ps1 -Environment production
Our GitHub Actions workflow includes a dedicated job for database migrations:
- The workflow first builds all services
- Before deployment, it runs a separate job to handle database migrations
- Migration job checks database status and then applies pending migrations
- Only after successful migrations are the services deployed
This ensures database schema compatibility with the new service versions before deployment.
To create a new migration for a service:
# Navigate to the service directory
cd services/[service-name]
# Create a new migration
npx prisma migrate dev --name your_migration_name
The migration will be added to the service's Prisma migration history and will be applied during the next deployment.
The Qbit Accounting System provides multiple approaches for managing secrets in Kubernetes:
Our CI/CD pipeline creates Kubernetes secrets automatically during deployment:
- Secrets are generated from GitHub repository secrets
- All secrets are created in the dedicated
qbit
namespace - The workflow uses
kubectl create secret
with the--dry-run
flag to safely apply secrets
Required GitHub secrets:
POSTGRES_PASSWORD
: Password for PostgreSQL databaseJWT_SECRET
: Secret for JWT token signingSERVICE_JWT_SECRET
: Secret for service-to-service authenticationRABBITMQ_PASSWORD
: Password for RabbitMQ
For local development, we provide scripts to create secrets:
# PowerShell - Generate random secrets
.\scripts\create-secrets.ps1 -Namespace qbit -GenerateValues
# PowerShell - Use existing or prompt for secrets
.\scripts\create-secrets.ps1 -Namespace qbit
For production environments, we support using external secrets managers:
# Install External Secrets Operator with AWS integration
./k8s/external-secrets/setup-external-secrets.sh aws
# Install External Secrets Operator with Azure Key Vault integration
./k8s/external-secrets/setup-external-secrets.sh azure
These secrets are required for the system to function properly:
-
postgres-secrets
POSTGRES_PASSWORD
: PostgreSQL admin password
-
api-gateway-secrets
JWT_SECRET
: JWT token signing keySERVICE_JWT_SECRET
: Service-to-service auth token signing keyRABBITMQ_PASSWORD
: RabbitMQ password
-
auth-service-secrets
JWT_SECRET
: JWT token signing keySERVICE_JWT_SECRET
: Service-to-service auth token signing keyDATABASE_PASSWORD
: Database passwordRABBITMQ_PASSWORD
: RabbitMQ password
-
Service-specific secrets
- Each service has its own secrets with the pattern
{service-name}-secrets
- All service secrets include database passwords and auth tokens
- Each service has its own secrets with the pattern