A full-stack Task Manager Application that allows users to manage tasks with features to create, update, delete, and organize tasks by status. The application is divided into a Golang backend and a React frontend.
The frontend is built using React and provides a user-friendly interface for managing tasks. It includes:
- Task List: Displays all tasks with title, description, and status.
- Task Actions: Add new tasks, update their status, and delete tasks.
- Status Dropdown: A smooth dropdown interface for changing the status of a task.
- Responsive Design: Ensures a clean and readable interface.
The backend is built using Golang with Gin Framework and provides a RESTful API for managing tasks. It includes:
- Endpoints:
GET /tasks: Retrieve all tasks.POST /tasks: Create a new task.PUT /tasks/:id/status: Update the status of a task.DELETE /tasks/:id: Delete a task.
- Database:
- Uses an in-memory SQLite database for lightweight storage.
backend/
├── main.go # Entry point of the backend application
├── go.mod # Module dependencies
├── db/
│ └── tasks.db # SQLite database (created automatically)
├── models/
│ └── task.go # Task model definition
├── routes/
│ └── tasks.go # API routes for task management
├── Dockerfile # Dockerfile for backend service
frontend/
├── public/
│ └── index.html # Main HTML template
├── src/
│ ├── App.jsx # Main React component
│ ├── index.jsx # Entry point for React
│ ├── api/
│ │ └── tasks.js # API service for interacting with the backend
│ ├── styles/
│ │ └── index.css # Main CSS file for the application
│ ├── components/ # Reusable React components (optional future use)
│ │ ├── Task.js # Task component for displaying individual tasks
│ │ └── TaskList.js # TaskList component for displaying all tasks
├── package.json # NPM configuration and dependencies
├── Dockerfile # Dockerfile for frontend service
-
Install Dependencies:
go mod tidy
-
Run the Backend:
go run main.go
The backend will start on
http://localhost:8080. -
Test Backend API: Use a tool like Postman or cURL to test API endpoints. Examples:
# Create a new task curl -X POST http://localhost:8080/tasks -H "Content-Type: application/json" -d '{"title":"Sample Task", "description":"Description of the task"}' # Get all tasks curl http://localhost:8080/tasks # Update task status curl -X PUT http://localhost:8080/tasks/1/status -H "Content-Type: application/json" -d '{"status":"Done"}' # Delete a task curl -X DELETE http://localhost:8080/tasks/1
-
Install Dependencies: Navigate to the
frontend/directory and run:npm install
-
Run the Frontend:
npm start
The frontend will be available at
http://localhost:3000. -
Configure API Endpoint: Ensure the backend API URL is set in the
frontend/.envfile:REACT_APP_API_BASE=http://localhost:8080 -
Test the Frontend: Open a browser and navigate to
http://localhost:3000to interact with the application.
This project is fully containerized using Docker.
-
Build and Start the Services: Currently the images built for amd64. run the images pushed to Docker Hub:
# Pull the backend image docker pull shay23bra/task-manager-backend:latest # Pull the frontend image docker pull shay23bra/task-manager-frontend:latest # Run the services docker run -d -p 8080:8080 --name task-manager-backend shay23bra/task-manager-backend:latest docker run -d -p 3000:80 --name task-manager-frontend shay23bra/task-manager-frontend:latest
Or, build the images locally:
- For mac/linux users: In order to build locally for arm64, in the backend Dockerfile change GOARCH=amd64 to GOARCH=arm64.
In the root directory of the project (where
docker-compose.ymlis located), run:docker-compose up --build
-
Access the Services:
- Frontend: http://localhost:3000
- Backend: http://localhost:8080
-
Stop the Services:
docker-compose down
A CI/CD pipeline is implemented using GitHub Actions.
-
Trigger:
- The pipeline runs on every pull request to the
mainbranch and on direct pushes to themainbranch.
- The pipeline runs on every pull request to the
-
Stages:
- Testing:
- Runs backend tests using
go test. - Runs frontend tests using
npm test.
- Runs backend tests using
- Linting:
- Lints the backend code with
go vet. - Lints the frontend code with
npm run lint.
- Lints the backend code with
- Build and Push:
- Builds Docker images for the backend and frontend.
- Pushes the Docker images to Docker Hub.
- Testing:
The CI pipeline is defined in .github/workflows/ci.yml and includes running tests, linting, and building and pushing Docker images. (shay23bra/task-manager-backend:latest, shay23bra/task-manager-frontend:latest)
Run unit tests for the backend using the Go testing package. Ensure that you’ve written tests for each API endpoint.
Example:
go test ./... -vRun frontend tests using Jest and React Testing Library.
-
Run Frontend Tests:
npm test -
Example Test Cases:
- Test if tasks are correctly displayed.
- Test if new tasks are added successfully.
- Test if dropdown animations and status changes work.
- Authentication:
- Add user authentication to secure task management.
- Persistent Database:
- Replace in-memory SQLite with a persistent database like PostgreSQL or MySQL.
- Search and Filters:
- Add search functionality and status-based filters in the UI.
- Mobile Responsiveness:
- Improve styling for smaller screens.
- Packages and Dependencies:
- Use newer versions of packages and dependencies, remove deprecated ones.
- Build and Deployment:
- Use multi-platform build for Docker images - to support both arm64 and amd64.
- UI design:
- Improve the UI design and add more features like drag-and-drop tasks.