A RESTful API for managing notes built with Go Fiber, featuring JWT authentication, image uploads, and PostgreSQL database.
- CRUD operations for notes
- JWT-based authentication
- Image upload with multipart form data
- PostgreSQL database with GORM
- Docker Compose for easy deployment
- Environment-based configuration
- Swagger/OpenAPI documentation
- Clone the repository
- Copy
.env.example
to.env
and configure your environment variables - Run with Docker Compose:
docker-compose up --build
The API will be available at http://localhost:3000
Access the interactive API documentation at: http://localhost:3000/swagger/
The Swagger documentation provides:
- Complete API endpoint documentation
- Interactive testing interface
- Request/response examples
- Authentication setup instructions
POST /api/auth/register
- Register a new userPOST /api/auth/login
- Login user
GET /api/notes
- Get all notes for authenticated userGET /api/notes/:id
- Get specific notePOST /api/notes
- Create new note (supports image upload)PUT /api/notes/:id
- Update noteDELETE /api/notes/:id
- Delete note
Notes can include images by sending multipart form data with an image
field.
DB_HOST
- Database hostDB_USER
- Database usernameDB_PASSWORD
- Database passwordDB_NAME
- Database nameDB_PORT
- Database portJWT_SECRET
- JWT signing secretPORT
- Application port
To run locally without Docker:
- Install dependencies:
go mod tidy
- Set up PostgreSQL database
- Configure
.env
file - Run:
go run main.go