Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hoangsonww/todo-app-nextjs-fullstack

๐ŸŽฏ 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! Live at: https://to-do-app-next-js-fullstack.vercel.app/.
https://github.com/hoangsonww/todo-app-nextjs-fullstack

full-stack full-stack-web-development fullstack-development material-ui next next-auth next-js nextjs responsive rest-api restful-api server-side-rendering sqlite sqlite3 todo todo-app todoapp todolist typescript

Last synced: 7 days ago
JSON representation

๐ŸŽฏ 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! Live at: https://to-do-app-next-js-fullstack.vercel.app/.

Awesome Lists containing this project

README

        

# 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**](#-features)
- [๐Ÿ–ผ๏ธ **UI Preview**](#-ui-preview)
- [**Landing Page**](#landing-page)
- [**Light Mode**](#light-mode)
- [**Dark Mode**](#dark-mode)
- [**Login Page**](#login-page)
- [**Light Mode**](#light-mode-1)
- [**Dark Mode**](#dark-mode-1)
- [**Register Page**](#register-page)
- [**Light Mode**](#light-mode-2)
- [**Dark Mode**](#dark-mode-2)
- [**Homepage (To-Do List)**](#homepage-to-do-list)
- [**Light Mode**](#light-mode-3)
- [**Dark Mode**](#dark-mode-3)
- [๐Ÿ“‚ **File Structure**](#-file-structure)
- [๐Ÿ“‹ **API Endpoints**](#-api-endpoints)
- [**1. Prerequisites**](#1-prerequisites)
- [**2. Clone the Repository**](#2-clone-the-repository)
- [**3. Install Dependencies**](#3-install-dependencies)
- [**4. Set Up Environment Variables**](#4-set-up-environment-variables)
- [**5. Run the Development Server**](#5-run-the-development-server)
- [**6. Build for Production**](#6-build-for-production)
- [๐ŸŒ **Using the App**](#-using-the-app)
- [๐Ÿ’ก **Notes**](#-notes)
- [๐Ÿงช **Testing**](#-testing)
- [**Running Tests**](#running-tests)
- [๐Ÿš€ **Live Deployment**](#-live-deployment)
- [๐Ÿณ **Containerization**](#-containerization)
- [๐Ÿ”ง **Contributing**](#-contributing)
- [๐Ÿ“ **License**](#-license)
- [๐Ÿ“ง **Contact**](#-contact)

## ๐ŸŒŸ **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
- 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

## ๐Ÿ–ผ๏ธ **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

## ๐Ÿ“‚ **File Structure**

Below is the comprehensive file structure for the project:

```
todo-app-fullstack-nextjs/
โ”‚
โ”œโ”€โ”€ public/
โ”‚ โ”œโ”€โ”€ favicon.ico
โ”‚ โ””โ”€โ”€ images/ # Placeholder for UI images
โ”‚
โ”œโ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ app/
โ”‚ โ”‚ โ”œโ”€โ”€ api/ # Backend API endpoints
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ todos/
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ route.ts # Full CRUD operations for todos
โ”‚ โ”‚ โ”‚
โ”‚ โ”‚ โ”œโ”€โ”€ auth/ # Authentication pages
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ login/
โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ page.tsx # Login page
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ register/
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ page.tsx # Registration page
โ”‚ โ”‚ โ”‚
โ”‚ โ”‚ โ”œโ”€โ”€ landing/
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ page.tsx # Landing page
โ”‚ โ”‚ โ”‚
โ”‚ โ”‚ โ”œโ”€โ”€ layout.tsx # Layout for the entire app
โ”‚ โ”‚ โ”œโ”€โ”€ page.tsx # Homepage with conditional redirect logic
โ”‚ โ”‚ โ””โ”€โ”€ globals.css # Global CSS styles
โ”‚ โ”‚
โ”‚ โ”œโ”€โ”€ components/ # Reusable components
โ”‚ โ”‚ โ”œโ”€โ”€ Navbar.tsx # Navbar component
โ”‚ โ”‚ โ””โ”€โ”€ Footer.tsx # Footer component
โ”‚ โ”‚
โ”‚ โ”œโ”€โ”€ styles/ # Additional styles if needed
โ”‚ โ”‚ โ””โ”€โ”€ page.css
โ”‚ โ”‚
โ”‚ โ””โ”€โ”€ utils/ # Utility functions (e.g., authentication helpers)
โ”‚ โ””โ”€โ”€ auth.ts
โ”‚
โ”œโ”€โ”€ .env.local # Environment variables (if using)
โ”œโ”€โ”€ next.config.js # Next.js configuration
โ”œโ”€โ”€ package.json # Project dependencies and scripts
โ””โ”€โ”€ 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 |

## ๐Ÿ› ๏ธ **Getting Started**

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

### **1. Prerequisites**

Ensure you have the following installed:

- [Node.js](https://nodejs.org/en/download/) (v14 or later)
- [npm](https://www.npmjs.com/) or [Yarn](https://yarnpkg.com/)

### **2. Clone the Repository**

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

### **3. Install Dependencies**

If you're using npm:

```bash
npm install
```

Or, if you're using Yarn:

```bash
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:

```bash
npm run dev
```

Or, if using Yarn:

```bash
yarn dev
```

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

### **6. Build for Production**

To build the project for production, run:

```bash
npm run build
```

Or, if using Yarn:

```bash
yarn build
```

To start the production server:

```bash
npm run start
```

Or:

```bash
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.
3. **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.

## ๐Ÿ’ก **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:

```bash
npm run test
```

Or, if using Yarn:

```bash
yarn test
```

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

## ๐Ÿš€ **Live Deployment**

The application is deployed live on **Vercel**. You can access it at [https://to-do-app-next-js-fullstack.vercel.app/](https://to-do-app-next-js-fullstack.vercel.app/).

## ๐Ÿณ **Containerization**

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

```bash
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](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 โ†‘](#todo-app-fullstack-nextjs)