|
| 1 | +# Folder Structure (GOT - Go Template) |
| 2 | + |
| 3 | +### Root Level: |
| 4 | + |
| 5 | +- `cmd/` |
| 6 | + Main application entry point. For example, `cmd/got-api/` contains the code that starts your Go API server. |
| 7 | + |
| 8 | +- `configs/` |
| 9 | + Configuration files (JSON). You can define different files for different environments like dev, prod, etc. |
| 10 | + |
| 11 | +- `docs/` |
| 12 | + Project documentation (you are probably reading this from here). Good place to put extra docs like folder structure, setup, usage tips, etc. |
| 13 | + |
| 14 | +- `internal/` |
| 15 | + Application-specific packages. This code is private to your app and cannot be imported by others. |
| 16 | + |
| 17 | + - `internal/api/` – HTTP routes, handlers, and middleware. |
| 18 | + - `internal/cli/` – CLI commands and utilities. |
| 19 | + - `internal/config/` – Load and manage app configs. |
| 20 | + - `internal/database/` – DB connection and setup logic. |
| 21 | + - `internal/models/` – App data models (e.g. User, Token) for ORM/SQL. |
| 22 | + - `internal/dto/` – Request and response data structs. |
| 23 | + - `internal/repositories/` – DB queries and data access. |
| 24 | + - `internal/services/` – Business logic and processing. |
| 25 | + - `internal/utils/` – Helpers like JWT, email, hashing. |
| 26 | + |
| 27 | +- `migrations` |
| 28 | + SQL migration files used for database schema changes. Managed via `make migrate-up` and `make migrate-down` commands. |
| 29 | + |
| 30 | +- `test` |
| 31 | + Contains end-to-end (e2e) and integration tests. |
| 32 | + (Note: Unit tests are placed alongside the logic files using `_test.go` suffix, like `user_test.go`.) |
| 33 | + |
| 34 | +- `Makefile` |
| 35 | + Automation commands for local development (`make setup`, `make dev`, etc.) |
| 36 | + |
| 37 | +- `Dockerfile` |
| 38 | + Defines how to build and run the app inside a Docker container. |
| 39 | + |
| 40 | +- `.dockerignore` |
| 41 | + Lists files and folders to exclude from the Docker build context. |
| 42 | + |
| 43 | +- `.env` |
| 44 | + Environment-specific variables used during local development. |
| 45 | + |
| 46 | +- `.env.example` |
| 47 | + A sample environment file to show required variables. Used as a reference. |
| 48 | + |
| 49 | +- `go.mod` / `go.sum` |
| 50 | + Go module definition and dependencies. |
| 51 | + |
| 52 | +- `README.md` |
| 53 | + Main documentation file with instructions, setup, features, etc. |
| 54 | + |
| 55 | +Of course Gaurav bhai! Here's the improved version of your summary: |
| 56 | + |
| 57 | +### Summary: |
| 58 | + |
| 59 | +This folder structure follows Go best practices. After running the `make setup` command, only the folders relevant to your selected features will remain — giving you a clean, minimal, and ready-to-use project structure. |
0 commit comments