This project is a GraphQL API built with Go that serves address data. It was created as a learning exercise to explore GraphQL server development in Go, including database migration, testing, and authentication with API keys.
- GraphQL API: Exposes address data through a clean GraphQL interface.
- SQLite Database: Uses a local SQLite database for data persistence.
- Database Migration: Includes a script to migrate data from JSON files into the database.
- Authentication: Protects specific queries using an API key and GraphQL directives.
- Repository Pattern: Separates database logic from the API layer for clean architecture.
- Integration & Unit Tests: Includes tests for both the repository (with a real in-memory DB) and the resolvers (with mocks).
- Dockerized: Comes with a
Dockerfilefor easy containerization and deployment.
- Language: Go
- GraphQL Server: gqlgen
- Database: SQLite3
- Containerization: Docker
- HTTP Middleware: rs/cors
- Go (version 1.21 or later)
- Docker Desktop (for containerizing)
make(optional, for using the Makefile shortcuts)
Clone the repository to your local machine:
git clone [email protected]:xaaha/address-api.git
cd address-api
- Start the server
make server