I created this project to learn backend technologies by extending a React TODO app I was building to explore React Context, Reducers, and Memoization. I then wanted to gain hands-on experience with backend development, so I decided to implement a Golang backend for authentication and data management.
This project primarily serves as a learning experience for backend development, with a focus on Golang and MongoDB.
π§ Note: The frontend has not been integrated into this project yet. π§
- User authentication with JWT
- Secure password storage using bcrypt
- Rate-limiting with ratelimit
- CRUD operations with MongoDB
- Email functionality with Postmark (for account verification, password reset, etc.)
- Backend uses Air for live reloading during development
- Golang β Backend language
- Gin β Web framework
- Air β Live reloading for development
- jwt-go β JWT-based authentication
- bcrypt β Password hashing
- ratelimit β Rate limiting
- MongoDB β Database
- Postmark β Email service for sending verification and notification emails
- React β UI Library
- TypeScript β Static typing
- Node.js & npm installed (for frontend, once integrated)
- Golang installed
- MongoDB running β Either:
- MongoDB Atlas account (for a cloud-hosted database)
- Local MongoDB instance installed manually
- Docker-based MongoDB instance (see Docker setup instructions)
- Postmark account (for email functionality)
# Clone the repository
git clone git@github.com:suitableDev/myTaskManager.git
cd myTaskManager
# Install backend dependencies (the tools our code needs)
cd server
go mod tidyTo ensure the backend can connect to the database, properly handle authentication, and integrate email functionalities, rename either:
-
example.envto.env -
example.docker-compose.envtodocker-compose.envfor Dockerised version
then update the following values:
# Leave this unless you're running mongodb locally WITHOUT docker
MONGO_URI=mongodb://mongo:27017
# Change these
SECRET_KEY="your_secret_key_for_jwt_hashing"
POSTMARK_API_TOKEN="your-postmark-api-token"
POSTMARK_SENDER_EMAIL="your-verified-email@example.com"
POSTMARK_EMAIL_LINK_ADDRESS="your_site_address"- MONGO_URI β Set this to your MongoDB connection string.
- SECRET_KEY β Set this to any secure string for signing JWT tokens.
- POSTMARK_API_TOKEN β Set this to your Postmark API token for email sending.
- POSTMARK_SENDER_EMAIL β Set this to the email address you have verified with Postmark.
- POSTMARK_EMAIL_LINK_ADDRESS β Set this to the base URL for your site (used for email link generation).
# Install 'air' for live reloading (makes development easier!)
go install github.com/cosmtrek/air@latest
# Run the backend with live reloading
airFrom main app folder. Ensure you have updated the example docker-compose.env
Build and start the backend and database using Docker Compose
docker-compose up --buildAccess the application at: http://localhost:8080
# Stops the containers
docker-compose down
# Stops the containers and removes persitant data
docker-compose down -v### Check the server is up and running
http://localhost:8080/health