https://github.com/geniewizards/zenmo
Backend repository for finance management system
https://github.com/geniewizards/zenmo
bun docker-compose drizzle-orm hono lucia-auth
Last synced: 5 months ago
JSON representation
Backend repository for finance management system
- Host: GitHub
- URL: https://github.com/geniewizards/zenmo
- Owner: GenieWizards
- License: mit
- Created: 2024-10-29T16:45:36.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-03-03T12:59:07.000Z (7 months ago)
- Last Synced: 2025-03-15T00:51:11.885Z (7 months ago)
- Topics: bun, docker-compose, drizzle-orm, hono, lucia-auth
- Language: TypeScript
- Homepage:
- Size: 1.09 MB
- Stars: 2
- Watchers: 0
- Forks: 1
- Open Issues: 24
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Finance Management API
A backend repository for the finance management system.
## Table of Contents
- [Finance Management API](#finance-management-api)
- [Tech Stack](#tech-stack)
- [To Setup Locally](#to-setup-locally)
- [Check API Documentation](#check-api-documentation)
- [Database Migrations](#database-migrations)## Tech Stack
- **Language:** TypeScript 
- **Runtime:** Bun 
- **Package Manager:** Bun 
- **Auth:** Lucia Auth 
- **Database:** PostgreSQL 
- **ORM/ODM:** Drizzle 
- **Testing:** Bun 
- **Documentation:** OpenAPI/Scalar  
- **Containerization:** Docker  Docker Compose ## To Setup Locally
- 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](https://bun.sh).```bash
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
```## 🐳 Docker Development Setup
This project uses Docker for both development and production environments. Below are the instructions to get started.
### Prerequisites
- Docker and Docker Compose installed on your machine
- Make (usually pre-installed on macOS/Linux)### Available Make Commands
```bash
# 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
```### Quick Start (Development)
1. Clone the repository
2. Copy the environment file:```bash
cp .env.example .env
```3. Start the development environment:
```bash
make dev-build
make dev-up
```The application will be available at `http://localhost:8998`
### Development Notes
- 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 `), you'll need to rebuild the containers:
```bash
make dev-down
make dev-build
make dev-up
```### Database
- 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### Troubleshooting
If you encounter any issues:
1. Clean Docker resources:
```bash
make clean
```2. Rebuild everything:
```bash
make rebuild
```3. Check logs:
```bash
make logs
```### Test Environment Setup
1. Create a test environment file:
```bash
cp .env.example .env.test
```2. Update the `.env.test` file with the following configurations:
```env
LOG_LEVEL=silent
DATABASE_URL=postgres://root:root@localhost:5432/finance-management-api-test
```3. When running tests, the application will automatically use `.env.test` configuration:
```bash
bun run test
```Note: The test database will be automatically created and migrated when running tests.
### Production Deployment
For production deployment:
```bash
make build
make up
```Note: Make sure to set appropriate environment variables for production use.
## Check API Documentation
- The API documentation is available at {{API_URL}}/reference
## Database Migrations
If the schema is added/updated, you need to generate and apply the migrations:
```bash
bun db:generate # Generates the migration
bun db:migrate # Applies the migration
```## Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
## License
This project is licensed under the MIT License - see the LICENSE file for details.