A secure and lightweight RESTful API ToDo Application built with Go (Golang). This project implements a clean architecture and features user authentication and authorization using JWT (JSON Web Token).
- User Authentication: Secure Sign Up, Login, and Logout using JWT tokens.
- ToDo CRUD Operations: Complete task management capabilities (Create, Read, Update, Delete) mapped to specific users.
- Database Migrations: Structured database schema tracking via SQL migration scripts.
- Live Reloading: Hot reloading during development enabled through the
Airtoolkit.
Follow these step-by-step instructions to get a local copy of the project up and running on your machine.
Clone the project from GitHub and navigate into the project directory:
git clone [https://github.com/hyper-lynn/ToDoAppwithJWT.git](https://github.com/hyper-lynn/ToDoAppwithJWT.git)
cd ToDoAppwithJWTThe application requires several environment configurations to run properly.Create a file named .env in the root directory of the project and populate it with the following environment variables. Adjust the database credentials to match your local setup:
DATABASE_URL=postgres://username:password@localhost:5432/todo_api?sslmode=disable
PORT=8080
JWT_SECRET=your_screte_key
Initialize and download all the required Go modules and external libraries:
go mod downloadYou can spin up the application using either standard Go commands or the live-reload tool.
go run cmd/api/main.goThe project comes pre-configured with .air.toml. If you have Air installed, simply run:
air├── cmd/
│ └── api/ # Main entry point of the application (main.go)
├── internal/ # Core business logic, Handlers, Controllers, and Repositories
├── migrations/ # SQL migration files for structured database setup
├── scripts/ # Internal helper scripts
├── .air.toml # Air tool configuration for live-reload development
└── go.mod # Go modules dependency file
