A clean, production-ready Go backend template featuring:
- Go Fiber web framework
- Postgres 16 (Dockerized)
- CRUD Notes API
- In-memory metrics endpoint
- Structured logging (zerolog)
- Dockerfile + docker-compose
- Organized project structure
- Easily extendable into AI/RAG systems
This template is the foundation for the RAG extension found in the upcoming repository:
notes-memory-core-rag (coming next)
notes-memory-core/
│
├── main.go
├── go.mod
├── Dockerfile
├── docker-compose.yml
├── .env.example
│
└── internal/
├── database/
│ └── database.go
├── handlers/
│ └── notes.go
└── middleware/
├── logger.go
└── metrics.go
git clone https://github.com/ai-backend-course/notes-memory-core.git
cd notes-memory-core
Copy .env.example to .env (for local development):
cp .env.example .env
docker-compose up --build
The API will be available at:
http://localhost:8080
This service provides CRUD operations for notes and stores them in Postgres. It includes logging, metrics, and clean handler separation using Fiber.
flowchart TD
A[Client] --> B[HTTP API - Fiber]
B --> C[Handlers]
C --> D[Database Layer]
D --> E[(Postgres)]
B --> F[Middleware]
F -->|Logging| B
F -->|Metrics| B
GET /health
GET /notes
POST /notes
Content-Type: application/json
{
"title": "My note",
"content": "This is a sample note"
}
GET /metrics
Example response:
{
"total_requests": 10,
"total_errors": 0,
"avg_latency_ms": 1.2
}
| Component | Technology |
|---|---|
| Language | Go 1.22+ |
| Framework | Fiber v2 |
| Database | Postgres 16 |
| Driver | pgx / pgxpool |
| Logging | Zerolog |
| Metrics | Custom middleware |
| Containers | Docker + Docker Compose |
This repo is designed as a clean foundation for backend development in Go.
It intentionally includes:
- Clean HTTP routing
- Database migrations for a real table (
notes) - Structured logging with zerolog
- Metrics middleware for basic observability
- Dockerized Postgres and API container
- Realistic project layout
It is meant to be extended into:
- Vector search APIs
- Embeddings pipelines
- RAG (Retrieval-Augmented Generation) systems
- Multi-service AI backends
The next step in this series is the RAG-focused repository:
notes-memory-core-rag
MIT License.