Skip to content

Hopertz/API-Starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API Starter

This is a starter template for a Go-based API.

Project Structure

  • cmd/: Contains the main application entry point.
  • db/: Contains database-related files, including migrations and SQL queries.
    • migrations/: Database migration files.
    • queries/: SQL queries for sqlc.
    • sqlc/: Generated Go code from sqlc.
  • mail/: Contains mail-related functionality.
  • .env.example: Example environment variables file.
  • Makefile: Contains helper commands for development.
  • docker-compose.yml.example: Example Docker Compose file.
  • go.mod: Go module file.
  • go.sum: Go module checksums.
  • sqlc.yaml: Configuration for sqlc.

Getting Started

  1. Copy .env.example to .env and fill in your environment variables.
  2. Run make vendor to install dependencies.
  3. Run make db/migrations/up to apply database migrations.
  4. Run make run/api to start the API server.

Makefile Commands

  • run/api: Run the API server.
  • db/psql: Connect to the database using psql.
  • db/migrations/new name=<migration_name>: Create a new database migration.
  • db/migrations/up: Apply all up migrations.
  • db/migrations/down: Apply all down migrations.
  • audit: Format, vet, and test the code.
  • vendor: Tidy, verify, and vendor Go module dependencies.
  • sqlc: Generate Go code from SQL queries using sqlc.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors