Skip to content

🎯 Discovering the power of Next.js as a full-stack framework with a feature-rich, responsive To-Do app that combines seamless frontend and backend integration with Server-Side Rendering (SSR). Built with Next.js, SQLite3, and TypeScript!

License

Notifications You must be signed in to change notification settings

hoangsonww/ToDo-App-NextJS-Fullstack

Repository files navigation

ToDo-App-Fullstack-NextJS

Welcome to the ToDo-App-Fullstack-NextJS, a full-stack, lightweight, and simple to-do application built using Next.js with both backend and frontend integrated seamlessly.

This project shows the power of Next.js and serves as a practical demonstration of using Next.js as a complete full-stack framework, incorporating authentication, dark mode, and local storage for data persistence.

Table of Contents

🌟 Features

  • Full authentication system (Register and Login)
  • Dark and Light mode
  • User-specific to-do lists with different categories
  • CRUD operations for to-do items
  • MongoDB database for data storage
  • WebSockets for real-time updates to To-Do items
  • Responsive design
  • Add, edit, delete, and complete tasks
  • Persistent storage using SQLite and in-memory storage
  • A clean, modern, and responsive UI
  • PWA support with offline capabilities
  • Basic testing for API endpoints and utility functions
  • Easy-to-understand file structure and codebase
  • Customizable with additional features and improvements

πŸš€ Live Deployment

The application is deployed live on Vercel. You can access it at https://todo-app-nextjs-stack.vercel.app/.

The app features a landing page, authentication (login, register, and forgot password), a to-do list, and a Swagger API documentation page, as well as real-time to-do updates using WebSockets.

πŸ–ΌοΈ UI Preview

Landing Page

Light Mode

Landing Page

Dark Mode

Landing Page in Dark Mode

Login Page

Light Mode

Login Page

Dark Mode

Login Page in Dark Mode

Register Page

Light Mode

Register Page

Dark Mode

Register Page in Dark Mode

Homepage (To-Do List)

Light Mode

Homepage

Dark Mode

Homepage in Dark Mode

Forgot Password Page

Light Mode

Forgot Password Page

Dark Mode

Forgot Password Page in Dark Mode

πŸ“‚ File Structure

Below is the comprehensive file structure for the project:

todo-app-fullstack-nextjs/
β”‚
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ sitemap.xml
β”‚   β”œβ”€β”€ robots.txt
β”‚   β”œβ”€β”€ manifest.json
β”‚   β”œβ”€β”€ favicon.ico
β”‚   └── images/
β”‚
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/                     # Backend API endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ swagger.ts           # Swagger API documentation
β”‚   β”‚   β”‚   β”œβ”€β”€ auth/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ login/
β”‚   β”‚   β”‚   β”‚   β”‚   └── route.ts     # Login route
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ register/
β”‚   β”‚   β”‚   β”‚   β”‚   └── route.ts     # Registration route
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ reset-password/
β”‚   β”‚   β”‚   β”‚   β”‚   └── route.ts     # Reset password route
β”‚   β”‚   β”‚   β”‚   └── verify-email/
β”‚   β”‚   β”‚   β”‚       └── route.ts     # Email verification route
β”‚   β”‚   β”‚   └── todos/
β”‚   β”‚   β”‚       └── route.ts         # Full CRUD operations for todos
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ auth/                    # Authentication pages
β”‚   β”‚   β”‚   β”œβ”€β”€ reset-password/
β”‚   β”‚   β”‚   β”‚   └── page.tsx         # Reset password page
β”‚   β”‚   β”‚   β”œβ”€β”€ login/
β”‚   β”‚   β”‚   β”‚   └── page.tsx         # Login page
β”‚   β”‚   β”‚   └── register/
β”‚   β”‚   β”‚       └── page.tsx         # Registration page
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ landing/
β”‚   β”‚   β”‚   └── page.tsx             # Landing page
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ swagger/
β”‚   β”‚   β”‚   └── page.tsx             # Swagger API documentation page
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ layout.tsx               # Layout for the entire app
β”‚   β”‚   β”œβ”€β”€ page.tsx                 # Homepage with conditional redirect logic
β”‚   β”‚   β”œβ”€β”€ page.css                 # Homepage styles
β”‚   β”‚   β”œβ”€β”€ page.module.css          # Homepage module styles
β”‚   β”‚   └── globals.css              # Global CSS styles
β”‚   β”‚
β”‚   β”œβ”€β”€ fonts/                       # Custom fonts
β”‚   β”‚
β”‚   └── types/                       # TypeScript types
β”‚       └── swagger-ui-react.d.ts    # Swagger UI types
β”‚
β”œβ”€β”€ nginx/                           # Nginx configuration
β”‚   β”œβ”€β”€ default.conf                 # Default Nginx configuration
β”‚   └── nginx.conf                   # Nginx configuration
β”‚
β”œβ”€β”€ kubernetes/                      # Kubernetes configuration
β”‚   β”œβ”€β”€ frontend-deployment.yaml     # Frontend deployment configuration
β”‚   β”œβ”€β”€ frontend-service.yaml        # Frontend service configuration
β”‚   β”œβ”€β”€ backend-deployment.yaml      # Backend deployment configuration
β”‚   β”œβ”€β”€ backend-service.yaml         # Backend service configuration
β”‚   └── configmap.yaml               # ConfigMap for environment variables
β”‚
β”œβ”€β”€ .env.local                       # Environment variables (if using)
β”œβ”€β”€ next.config.js                   # Next.js configuration
β”œβ”€β”€ Dockerfile                       # Docker configuration
β”œβ”€β”€ next.config.js                   # Next.js configuration
β”œβ”€β”€ package-lock.json                # Locked versions of dependencies
β”œβ”€β”€ package.json                     # Project dependencies and scripts
β”œβ”€β”€ tsconfig.json                    # TypeScript configuration
β”œβ”€β”€ Jenkinsfile                      # Jenkins CI/CD pipeline
β”œβ”€β”€ .gitignore                       # Files and directories to ignore
β”œβ”€β”€ .eslintrc.json                   # ESLint configuration
β”œβ”€β”€ manage_app.sh                    # Script to manage the app
β”œβ”€β”€ LICENSE                          # Project license
└── README.md                        # This README file

πŸ“‹ API Endpoints

Here's a table listing all the API endpoints provided by this application:

HTTP Method Endpoint Description
POST /api/auth/login Log in with username and password
POST /api/auth/register Register a new user
GET /api/todos Fetch all todos for a user
POST /api/todos Create a new to-do item
PUT /api/todos Update a to-do item
DELETE /api/todos Delete a to-do item
PATCH /api/todos Mark a to-do item as completed
POST /api/auth/reset-password Reset user password
POST /api/auth/verify-email Verify user email

πŸ› οΈ Getting Started

Follow this step-by-step guide to set up the project locally.

1. Prerequisites

Ensure you have the following installed:

2. Clone the Repository

git clone https://github.com/hoangsonww/ToDo-App-NextJS-Fullstack.git
cd ToDo-App-NextJS-Fullstack

3. Install Dependencies

If you're using npm:

npm install

Or, if you're using Yarn:

yarn install

4. Set Up Environment Variables

Create a .env.local file in the root directory if any environment variables are required. (Currently, the project doesn't use any external services that require environment variables).

5. Run the Development Server

Start the development server:

npm run dev

Or, if using Yarn:

yarn dev

The application should now be running at http://localhost:3000.

6. Build for Production

To build the project for production, run:

npm run build

Or, if using Yarn:

yarn build

To start the production server:

npm run start

Or:

yarn start

The production build will be served at http://localhost:3000.

🌐 Using the App

  1. Visit the Landing Page (/landing): Introduces the app with the option to log in or register.
  2. Authentication:
  • Register: Create a new account via the /auth/register page.
  • Login: Access your account through the /auth/login page.
  1. Manage To-Dos: Access the main to-do list page (/) where you can add, edit, and delete to-dos, as well as toggle dark mode.

Alternatively, you can directly access the deployed application at https://todo-app-nextjs-stack.vercel.app/.

πŸ“ Swagger API Documentation

The application includes a Swagger API documentation page that lists all the available API endpoints and their descriptions. You can access the Swagger documentation at /swagger.

Here is what it looks like:

Swagger API Documentation

πŸ’‘ Notes

  • This application uses local storage to manage user data and to-do items. For a more robust application, consider integrating a real database (e.g., MongoDB, PostgreSQL).
  • The dark mode toggle is handled with React state and applied to various components via Material-UI's ThemeProvider.

πŸ§ͺ Testing

Running Tests

This project includes a few basic tests for the API endpoints and utility functions. To run the tests, use the following command:

npm run test

Or, if using Yarn:

yarn test

The tests will run and display the results in the terminal.

🐳 Containerization

This project includes a Dockerfile for containerization. To build the Docker image, run:

docker compose up --build

This command will build the Docker image and start the container. The application will be accessible at http://localhost:3000.

πŸ”§ Contributing

Contributions are welcome! If you'd like to contribute, please fork the repository, make your changes, and create a pull request.

πŸ“ License

This project is licensed under the MIT License. See the LICENSE file for more information.

πŸ“§ Contact

For any inquiries or feedback, feel free to reach out to the author at [email protected].

Enjoy using the ToDo-App-Fullstack-NextJS! πŸŽ‰


Happy coding! πŸš€

Back to Top ↑

About

🎯 Discovering the power of Next.js as a full-stack framework with a feature-rich, responsive To-Do app that combines seamless frontend and backend integration with Server-Side Rendering (SSR). Built with Next.js, SQLite3, and TypeScript!

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published