Internal system to manage employee awards and nominations.
Manage the entire system lifecycle using the following workflows.
Get the system up and running from scratch.
./init.sh # 1. Initialize environment & .env
./docker.sh start # 2. Start containers
./docker.sh initial-config # 3. Full baseline setup (SUPER_ADMIN only)Default Admin:
admin@company.com/ChangeMe123
Resume development or production service.
./docker.sh start # 1. Start containers
./docker.sh migrate-up # 2. Apply any new database changesSafeguard or migrate your data.
./docker.sh backup-db # Create timestamped SQL dump
./docker.sh import-db <dump_path> # Restore from a specific snapshotCompletely clear all data and start fresh.
./docker.sh reset # ⚠️ Deletes ALL containers, volumes, and data
./docker.sh start
./docker.sh initial-configSets up the development environment:
- Creates
.envfile from.env.example - Optionally creates Python virtual environment
- Checks Docker installation
- Creates necessary directories
Usage:
./init.sh # Basic setup
./init.sh --venv # Setup with virtual environmentManages Docker containers, database migrations, and time-based backups.
Container Commands:
./docker.sh start- Start containers (background)./docker.sh stop- Stop containers./docker.sh restart- Restart containers./docker.sh logs- View API logs./docker.sh status- Show running containers./docker.sh reset-⚠️ Stop & remove containers + volumes (deletes data)
Migration Commands:
./docker.sh migrate-create 'message'- Create new migration./docker.sh migrate-up- Run all pending migrations./docker.sh migrate-down- Rollback last migration./docker.sh initial-config- Full initial configuration (SUPER_ADMIN only)
Database Backups:
./docker.sh backup-db- Create a timestamped SQL dump in./backups/YYYYMMDD-HHMMSS/./docker.sh import-db <path>- Restore database from a SQL snapshot
Examples:
./docker.sh start # Start containers
./docker.sh logs # View logs
./docker.sh migrate-create 'add user table'
./docker.sh migrate-up
./docker.sh migrate-downTesting, development utilities, and helpers.
Testing:
./test.sh all- Run all tests./test.sh coverage- Run tests with coverage./test.sh unit- Run unit tests only./test.sh integration- Run integration tests only
Development Tools:
./test.sh shell- Open shell in API container./test.sh db-shell- Open PostgreSQL shell./test.sh lint- Run linters./test.sh format- Format code
Database:
./test.sh init- Initialize database (run migrations)./test.sh seed- Create admin user (admin@company.com / ChangeMe123)
Note: The admin user is also created automatically when the API starts. Use ./test.sh seed to create it manually after initialization.
Utilities:
./test.sh status- Show environment status./test.sh clean- Clean up Docker resources
Examples:
./test.sh all # Run all tests
./test.sh shell # Access API container
./test.sh db-shell # Access database
./test.sh status # Check environment status
./test.sh seed # Create admin user-
Environmental Initialization: Use
./init.shto ensure your.envand dependencies are ready. -
Database Management: Always run
./docker.sh migrate-upafter pulling new changes to ensure your schema is in sync. Use./docker.sh migrate-create 'msg'for new changes. -
Baseline Data: Use
./docker.sh initial-configfor a production-ready baseline, or./docker.sh mock-seedfor a development environment with sample records. -
Testing: Run
./test.sh allbefore submitting pull requests. Use./test.sh coverageto check test density.
The application is configured via environment variables. Copy .env.example to .env to get started:
cp .env.example .env| Variable | Type | Default | Description |
|---|---|---|---|
APP_ENV |
String | dev |
System environment: local, dev, or prod. |
API_PORT |
Integer | 4100 |
The host port the API will listen on. |
DB_PORT |
Integer | 5433 |
The host port the Database will listen on. |
DATABASE_URL |
String | - | Connection string for PostgreSQL. |
JWT_SECRET |
String | - | CRITICAL: Secure random string for JWT signing. |
BACKEND_CORS_ORIGINS |
String | - | Comma-separated list of allowed frontend URLs. |
The system supports separate configurations for different stages of the lifecycle:
Optimized for rapid iteration with hot-reloading enabled.
- Config:
APP_ENV=localordev - Command:
./docker.sh start(usesdocker-compose.dev.yml)
Optimized for stability and performance.
- Config:
APP_ENV=prod,API_PORT=80 - Command:
docker-compose -f docker-compose.prod.yml up -d
If you encounter port conflicts (e.g., port 4100 is in use), simply update your .env file:
- Open
.env - Change
API_PORT=4101 - Restart the system:
./docker.sh restart
Once the server is running:
- Swagger UI: http://localhost:4100/docs
- ReDoc: http://localhost:4100/redoc
- Health Check: http://localhost:4100/api/v1/health
employee-awards-api/
├── app/ # Application code
│ ├── api/ # API routes
│ ├── core/ # Core utilities
│ ├── models/ # Database models
│ └── schemas/ # Pydantic schemas
├── alembic/ # Database migrations
├── docker/ # Dockerfiles
├── docker.sh # Docker container management
├── test.sh # Testing & development tools
├── init.sh # Initial setup
└── docker-compose.dev.yml
Database connection issues:
./test.sh status # Check container status
./docker.sh restart # Restart containersReset everything:
./docker.sh reset # WARNING: Deletes all data
./docker.sh start
./docker.sh initial-config- API Documentation - Full API implementation documentation
- FastAPI Docs - FastAPI framework documentation
- Alembic Docs - Database migration tool documentation