Chirpy is a simple Twitter-like backend API service built with Go.
- User Management: Create users and authenticate with JWT.
- Chirps: Post, delete, and retrieve "chirps" (short messages).
- Authentication: JWT-based authentication with support for refresh tokens.
- Database: PostgreSQL with SQLC for type-safe database access.
- Migrations: Database schema managed with SQL migrations.
- Language: Go
- Router: standard library
net/http - Database: PostgreSQL
- SQL Tool: SQLC
- Migrations: Goose
- Clone the repository.
- Set up your environment variables in a
.envfile (see.env.exampleif available). - Run migrations using Goose.
- Build and run the service:
go build -o chirpy && ./chirpy
You can build and run Chirpy in a container using the provided multi-stage Dockerfile.
-
Build the image:
docker build -t chirpy . -
Run the container: The application requires environment variables defined in a
.envfile. Use the--env-fileflag to pass them:docker run --env-file .env -p 8080:8080 chirpy
Note: Ensure your
DB_URLin.envpoints to a host reachable from within the container (e.g., using your machine's IP instead oflocalhostif the DB is running locally outside of Docker).
