NoteLink is a full-stack note management platform with a Go backend, MongoDB database, and React frontend.
- User Authentication: JWT-based authentication with bcrypt password hashing
- Note Management: CRUD operations with automatic timestamps
- Full-text Search: Search across note titles and content
- Note Sharing: Share notes with other users
- Rate Limiting: Built-in rate limiting via
golang.org/x/time/rate
- Language: Go 1.21.3
- Framework: Gorilla Mux
- Database: MongoDB 6.0
- Authentication: JWT (JSON Web Tokens)
- Password Hashing: bcrypt
- Rate Limiting: golang.org/x/time/rate
- Framework: React 18
- Routing: React Router v6
- HTTP Client: Axios
- Styling: Custom CSS with responsive design
- State Management: React Hooks and Context API
- Containerization: Docker & Docker Compose
- CI/CD: GitHub Actions
- Docker and Docker Compose
- Git
# Clone the repository
git clone https://github.com/priyanshu360/NoteLink.git
cd NoteLink
# Start the application
docker-compose up --build
# Backend API: http://localhost:8080
# Database: mongodb://admin:password123@localhost:27017/notelinkPOST /api/auth/signup- Create new user accountPOST /api/auth/login- Authenticate user and get JWT token
GET /api/notes- Get all user notesGET /api/notes/{id}- Get specific notePOST /api/notes- Create new notePUT /api/notes/{id}- Update existing noteDELETE /api/notes/{id}- Delete notePOST /api/notes/{id}/share- Share note with userGET /api/search?q={query}- Search notes
# Run all tests
go test ./...
# Run tests with coverage
go test -v -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.htmlcd frontend
npm test
npm run build- Single MongoDB connection: Previously two separate connections were created per server instance. Now a single
mongo.Clientis shared across all repositories. - Centralized JWT secret: Removed three duplicated
getJWTSecret()functions and a hardcoded fallback inutils/validators.go. JWT secret now reads fromJWT_SECRETenv var in one place (utils.GetJWTSecret()). - Proper context propagation: Replaced all 13
context.TODO()calls in the repository layer with request-scopedcontext.Contextthreaded from handlers through services to repositories, enabling proper cancellation and timeout propagation. - Wired up validators:
utils/validators.goValidateJWT()is now used byAuthMiddlewareandgetUserIDFromToken, replacing inline JWT parsing. - Removed dead config:
GIN_MODE=releaseremoved fromdocker-compose.yml(application uses Gorilla Mux, not Gin).