Backend architecture for Gayakini, an e-commerce platform for industrial suppliers.
- JDK 17
- Kotlin 2.0.21
- Spring Boot 3.4.0
- PostgreSQL (Flyway for migrations)
| Feature | Local (Host) | Dev (Docker) | Staging (Sim) |
|---|---|---|---|
| Profile | local |
dev |
staging |
| DB Host | localhost |
db (container) |
External / Env |
| Mail Host | localhost (Mailpit) |
mail (Mailpit) |
External / Env |
| Memory (JVM) | 20% - 50% RAM | 25% - 60% RAM | 25% - 70% RAM |
| Secrets Source | .env |
.env / Compose |
Environment Vars |
| Purpose | Fast Iteration | Container Integration | Pre-prod Validation |
- JDK 17
- Docker
We provide helper scripts for common environment flows:
Linux/macOS:
./scripts/dev.sh infra-up # Start DB/Mailpit on host
./scripts/dev.sh app-run # Run app via Gradle (Profile: local)
./scripts/dev.sh dev-stack # Full containerized stack (Profile: dev)Windows (PowerShell):
.\dev.ps1 infra-up # Start DB/Mailpit on host
.\dev.ps1 app-run # Run app via Gradle (Profile: local)
.\dev.ps1 dev-stack # Full containerized stack (Profile: dev)- Clone the repository.
- Set up environment variables:
cp .env.example .env. - Start local infrastructure:
docker compose up -d. - Run the application:
./gradlew bootRun. - Access the application:
- API:
http://localhost:8080 - Swagger UI:
http://localhost:8080/swagger-ui.html - Mailpit (Local Emails):
http://localhost:8025
- API:
The build lifecycle is designed to be explicit.
./gradlew ciBuild: Deterministic CI/CD pipeline task (KtLint -> Detekt -> Test -> Kover -> BootJar)../gradlew clean: Deletes the build directory../gradlew compileKotlin: Compiles the source code../gradlew test: Runs the unit and integration test suite../gradlew ktlintCheck: Validates Kotlin code style../gradlew detekt: Performs static code analysis../gradlew koverHtmlReport: Generates a coverage report inbuild/reports/kover/html/index.html../gradlew bootJar: Assembles the executable JAR../gradlew generateOpenApiDocs: Generates a static OpenAPI specification atdocs/openapi/openapi.yaml.
The CI/CD pipeline (.github/workflows/ci.yml) enforces the following quality gates:
- Validation:
ktlintCheck->detekt->test->koverVerify->bootJar. - Artifact Publication: If the
mainbranch passes validation, a Docker image is built and pushed to GitHub Container Registry (GHCR).- Tags:
latest,sha-{commit-hash}.
- Tags:
./gradlew ciBuildThe Dockerfile also uses the ciBuild task to ensure that no image is built with failing tests or quality gate violations.