A backend repository for the finance management system.
- Language: TypeScript
- Runtime: Bun
- Package Manager: Bun
- Auth: Lucia Auth
- Database: PostgreSQL
- ORM/ODM: Drizzle
- Testing: Bun
- Documentation: OpenAPI/Scalar
- Containerization: Docker Docker Compose
- This project uses Bun as its package manager. You need to have Bun installed on your system.
- To install Bun, follow the official guide at bun.sh.
git clone https://github.com/GenieWizards/finance-management-api.git # Clone the repo
cd finance-management-api # Navigate to the cloned folder
bun install # Install necessary dependencies using Bun package manager
bun dev # Start the server in development mode
This project uses Docker for both development and production environments. Below are the instructions to get started.
- Docker and Docker Compose installed on your machine
- Make (usually pre-installed on macOS/Linux)
# Show all available commands
make help
# Development Commands
make dev-build # Build development environment
make dev-up # Start development environment
make dev-down # Stop development environment
# Production Commands
make build # Build production environment
make up # Start production environment
make down # Stop production environment
make restart # Restart the application
# Utility Commands
make logs # View logs from all containers
make ps # List running containers
make shell # Open a shell in the API container
make migrate # Run database migrations
make clean # Stop containers, remove volumes, and prune system
-
Clone the repository
-
Copy the environment file:
cp .env.example .env
-
Start the development environment:
make dev-build make dev-up
The application will be available at http://localhost:8998
- The development environment includes hot reloading. Any changes to the source code will automatically reflect in the running application.
- When adding new dependencies (
bun add <package>
), you'll need to rebuild the containers:make dev-down make dev-build make dev-up
- PostgreSQL is available at
localhost:5432
- Default credentials (development):
User: root Password: root Database: finance-management-api-dev
- Migrations are run automatically when the container starts
If you encounter any issues:
-
Clean Docker resources:
make clean
-
Rebuild everything:
make rebuild
-
Check logs:
make logs
-
Create a test environment file:
cp .env.example .env.test
-
Update the
.env.test
file with the following configurations:LOG_LEVEL=silent DATABASE_URL=postgres://root:root@localhost:5432/finance-management-api-test
-
When running tests, the application will automatically use
.env.test
configuration:bun run test
Note: The test database will be automatically created and migrated when running tests.
For production deployment:
make build
make up
Note: Make sure to set appropriate environment variables for production use.
- The API documentation is available at {{API_URL}}/reference
If the schema is added/updated, you need to generate and apply the migrations:
bun db:generate # Generates the migration
bun db:migrate # Applies the migration
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
This project is licensed under the MIT License - see the LICENSE file for details.