A Twitter-like social media API built with Go. This is an ongoing project; the README and features will evolve over time.
- REST API with JWT auth, user registration/login
- Built with Gin and Gorm (PostgreSQL)
- Structured logging, request metrics, and CORS enabled
- Swagger/OpenAPI documentation (generated with swag)
- Dockerized for local/dev; CI/CD via GitHub Actions
- Go 1.23
- Gin (HTTP), Gorm (ORM, Postgres)
- Swagger (swaggo), Prometheus metrics
- Docker + docker-compose
- GitHub Actions (CI + Deploy)
- Prerequisites
- Go 1.23+
- Docker (optional, for containerized dev)
- PostgreSQL (if running locally without Docker)
- Clone and enter the project
git clone https://github.com/nevzattalhaozcan/forgotten.git
cd forgotten- Configure environment
- Copy
.env.exampleto.envand adjust as needed:DB_URL(e.g., postgres://user:password@localhost:5432/forgotten_db?sslmode=disable)
- Seed data lives at
data/seed_users.json.
# run the server
go run ./cmd/server
# server defaults to http://localhost:8080cd docker
docker-compose up -d
# API available at http://localhost:8080- The top-level annotations live in
cmd/server/main.go. - (If needed) generate/update docs:
go install github.com/swaggo/swag/cmd/swag@latest
swag init -g cmd/server/main.go -o ./docs- Swagger UI can be served at
/swaggeronce wired in the router.- If not yet enabled, add a route that uses
gin-swaggerand import the generateddocspackage.
- If not yet enabled, add a route that uses
Base path: /api/v1
- Unit tests:
go test -v -race ./...- Coverage:
go test -v -race -coverprofile=coverage.out ./...Note: Most tests use an in-memory SQLite DB via pkg/testutil; add Postgres-backed integration tests as needed.
- Prometheus-compatible metrics middleware is included. Expose your metrics endpoint (e.g.,
/metrics) as you wire up monitoring.
cmd/server– application entrypointinternal/– config, database, handlers, repository, services, middleware, modelspkg/– shared libs (logger, metrics, utils, test utilities)docs/– generated Swagger docsdocker/– Dockerfile, docker-compose, Prometheus configdata/– seed fixtures
.github/workflows/ci.ymlruns tests, lint, and build on PRs/commits..github/workflows/deploy.ymlbuilds and pushes a Docker image and deploys over SSH on main (requires repo secrets).
- More endpoints (profiles, posts, timelines)
- RBAC/permissions
- Full integration test suite
- Production-ready observability and hardening