Golang/Gin codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.
This codebase was created to demonstrate a fully fledged fullstack application built with Golang/Gin including CRUD operations, authentication, routing, pagination, and more.
- The project uses:
- gin-gonic/gin as the web framework
- jackc/pgx as the database driver
- kyleconroy/sqlc to generate Go code from SQL queries
- golang-migrate/migrate to manage database migrations
- golang-jwt/jwt for authentication
- zap for logging
- spf13/viper for configuration
- rs/xid for generating UUIDs
- stretchr/testify for testing
- golang/mock for mocking dependencies
- ory/dockertest for test database container during e2e test
- swaggo/swag for API documentation
- Also uses:
- PostgreSQL for the database
- Elasticsearch for the search engine (optional, to be implemented)
- Typesense for the search engine
Running the project locally:
docker-compose up -d // starts postgres container
go run main.go
Project starts on port 8085 by default and swagger documentation is available at http://localhost:8085/swagger/index.html.
First, run:
make test-run
This will start postgres container and the project itself. Then, run the tests with:
make e2e-test
make unit-test
- Add unit tests for handlers (... in progress)
- Improve error handling and logging
- Improve deployment and testing configuration (Makefile, docker-compose, etc.) ( ... in progress)
- Add search feature (
/search
, ...)