Skip to content

Commit 42fce3c

Browse files
committed
fix/update: docs folder added and folder-structure.md added
1 parent 10e0b67 commit 42fce3c

File tree

4 files changed

+89
-0
lines changed

4 files changed

+89
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ A Production-Ready Go template to kickstart your next Go lang Project.
1212
- [Configuration](#configuration)
1313
- [Dependencies](#dependencies)
1414
- [Migrations](#migrations)
15+
- [Documentation](#Documentation)
1516
- [Contributing](#contributing)
1617
- [License](#license)
1718

@@ -68,6 +69,10 @@ make migrate-up # Apply migrations
6869
make migrate-down # Rollback migrations
6970
```
7071

72+
## Documentation
73+
74+
- [Folder Structure](docs/folder-structure.md)
75+
7176
## Contributing
7277

7378
Feel free to open issues and submit PRs. All contributions are welcome!

docs/folder-structure.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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.

internal/dto/user_request.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package dto
2+
3+
type CreateUserRequest struct {
4+
Name *string `json:"name,omitempty"`
5+
Email string `json:"email" validate:"required,email"`
6+
Username *string `json:"username,omitempty"`
7+
Password string `json:"password" validate:"required,min=6"`
8+
}

internal/dto/user_response.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package dto
2+
3+
import (
4+
"time"
5+
)
6+
7+
type UserResponse struct {
8+
Id string `json:"id"`
9+
Name *string `json:"name,omitempty"`
10+
Username *string `json:"username,omitempty"`
11+
Email string `json:"email"`
12+
Role string `json:"role"`
13+
ProfilePic *string `json:"profile_pic"`
14+
Status string `json:"status"`
15+
CreatedAt time.Time `json:"created_at"`
16+
UpdatedAt time.Time `json:"updated_at"`
17+
}

0 commit comments

Comments
 (0)