Skip to content

Commit 7ee6024

Browse files
committed
Added Next.js BE & FE
1 parent 65b15d3 commit 7ee6024

26 files changed

+12997
-2368
lines changed

Dockerfile

Whitespace-only changes.

README.md

+239-19
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,256 @@
1-
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
1+
# ToDo-App-Fullstack-NextJS
22

3-
## Getting Started
3+
Welcome to the **ToDo-App-Fullstack-NextJS**, a full-stack and simple to-do application built using **Next.js** with both backend and frontend integrated seamlessly.
44

5-
First, run the development server:
5+
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.
6+
7+
## Table of Contents
8+
9+
- [🌟 **Features**](#-features)
10+
- [📂 **File Structure**](#-file-structure)
11+
- [📋 **API Endpoints**](#-api-endpoints)
12+
- [**1. Prerequisites**](#1-prerequisites)
13+
- [**2. Clone the Repository**](#2-clone-the-repository)
14+
- [**3. Install Dependencies**](#3-install-dependencies)
15+
- [**4. Set Up Environment Variables**](#4-set-up-environment-variables)
16+
- [**5. Run the Development Server**](#5-run-the-development-server)
17+
- [**6. Build for Production**](#6-build-for-production)
18+
- [🌐 **Using the App**](#-using-the-app)
19+
- [🖼️ **UI Preview**](#-ui-preview)
20+
- [**Landing Page**](#landing-page)
21+
- [**Login Page**](#login-page)
22+
- [**Register Page**](#register-page)
23+
- [**Homepage (To-Do List)**](#homepage-to-do-list)
24+
- [**Dark Mode**](#dark-mode)
25+
- [💡 **Notes**](#-notes)
26+
- [🧪 **Testing**](#-testing)
27+
- [**Running Tests**](#running-tests)
28+
- [🔧 **Contributing**](#-contributing)
29+
- [📝 **License**](#-license)
30+
- [📧 **Contact**](#-contact)
31+
32+
## 🌟 **Features**
33+
- Full authentication system (Register and Login)
34+
- Dark and Light mode
35+
- Add, edit, delete, and complete tasks
36+
- Persistent storage using SQLite and in-memory storage
37+
- A clean, modern, and responsive UI
38+
39+
## 📂 **File Structure**
40+
41+
Below is the comprehensive file structure for the project:
42+
43+
```
44+
todo-app-fullstack-nextjs/
45+
46+
├── public/
47+
│ ├── favicon.ico
48+
│ └── images/ # Placeholder for UI images
49+
50+
├── src/
51+
│ ├── app/
52+
│ │ ├── api/ # Backend API endpoints
53+
│ │ │ └── todos/
54+
│ │ │ ├── route.ts # Full CRUD operations for todos
55+
│ │ │
56+
│ │ ├── auth/ # Authentication pages
57+
│ │ │ ├── login/
58+
│ │ │ │ └── page.tsx # Login page
59+
│ │ │ └── register/
60+
│ │ │ └── page.tsx # Registration page
61+
│ │ │
62+
│ │ ├── landing/
63+
│ │ │ └── page.tsx # Landing page
64+
│ │ │
65+
│ │ ├── layout.tsx # Layout for the entire app
66+
│ │ ├── page.tsx # Homepage with conditional redirect logic
67+
│ │ └── globals.css # Global CSS styles
68+
│ │
69+
│ ├── components/ # Reusable components
70+
│ │ ├── Navbar.tsx # Navbar component
71+
│ │ └── Footer.tsx # Footer component
72+
│ │
73+
│ ├── styles/ # Additional styles if needed
74+
│ │ └── page.css
75+
│ │
76+
│ └── utils/ # Utility functions (e.g., authentication helpers)
77+
│ └── auth.ts
78+
79+
├── .env.local # Environment variables (if using)
80+
├── next.config.js # Next.js configuration
81+
├── package.json # Project dependencies and scripts
82+
└── README.md # This README file
83+
```
84+
85+
## 📋 **API Endpoints**
86+
87+
Here's a table listing all the API endpoints provided by this application:
88+
89+
| HTTP Method | Endpoint | Description |
90+
|-------------|----------------------|-----------------------------------|
91+
| `POST` | `/api/auth/login` | Log in with username and password |
92+
| `POST` | `/api/auth/register` | Register a new user |
93+
| `GET` | `/api/todos` | Fetch all todos for a user |
94+
| `POST` | `/api/todos` | Create a new to-do item |
95+
| `PUT` | `/api/todos` | Update a to-do item |
96+
| `DELETE` | `/api/todos` | Delete a to-do item |
97+
98+
## 🛠️ **Getting Started**
99+
100+
Follow this step-by-step guide to set up the project locally.
101+
102+
### **1. Prerequisites**
103+
104+
Ensure you have the following installed:
105+
106+
- [Node.js](https://nodejs.org/en/download/) (v14 or later)
107+
- [npm](https://www.npmjs.com/) or [Yarn](https://yarnpkg.com/)
108+
109+
### **2. Clone the Repository**
110+
111+
```bash
112+
git clone https://github.com/your-username/todo-app-fullstack-nextjs.git
113+
cd todo-app-fullstack-nextjs
114+
```
115+
116+
### **3. Install Dependencies**
117+
118+
If you're using npm:
119+
120+
```bash
121+
npm install
122+
```
123+
124+
Or, if you're using Yarn:
125+
126+
```bash
127+
yarn install
128+
```
129+
130+
### **4. Set Up Environment Variables**
131+
132+
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).
133+
134+
### **5. Run the Development Server**
135+
136+
Start the development server:
6137

7138
```bash
8139
npm run dev
9-
# or
140+
```
141+
142+
Or, if using Yarn:
143+
144+
```bash
10145
yarn dev
11-
# or
12-
pnpm dev
13-
# or
14-
bun dev
15146
```
16147

17-
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
148+
The application should now be running at `http://localhost:3000`.
149+
150+
### **6. Build for Production**
151+
152+
To build the project for production, run:
153+
154+
```bash
155+
npm run build
156+
```
157+
158+
Or, if using Yarn:
159+
160+
```bash
161+
yarn build
162+
```
163+
164+
To start the production server:
165+
166+
```bash
167+
npm run start
168+
```
169+
170+
Or:
171+
172+
```bash
173+
yarn start
174+
```
175+
176+
The production build will be served at `http://localhost:3000`.
177+
178+
## 🌐 **Using the App**
179+
180+
1. **Visit the Landing Page** (`/landing`): Introduces the app with the option to log in or register.
181+
2. **Authentication**:
182+
- Register: Create a new account via the `/auth/register` page.
183+
- Login: Access your account through the `/auth/login` page.
184+
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.
185+
186+
## 🖼️ **UI Preview**
187+
188+
### **Landing Page**
189+
<p align="center">
190+
<img src="public/images/landing-page.png" alt="Landing Page" width="600"/>
191+
</p>
192+
193+
### **Login Page**
194+
<p align="center">
195+
<img src="public/images/login-page.png" alt="Login Page" width="600"/>
196+
</p>
197+
198+
### **Register Page**
199+
<p align="center">
200+
<img src="public/images/register-page.png" alt="Register Page" width="600"/>
201+
</p>
202+
203+
### **Homepage (To-Do List)**
204+
<p align="center">
205+
<img src="public/images/homepage.png" alt="Homepage with To-Do List" width="600"/>
206+
</p>
207+
208+
### **Dark Mode**
209+
<p align="center">
210+
<img src="public/images/dark-mode.png" alt="App in Dark Mode" width="600"/>
211+
</p>
212+
213+
---
214+
215+
## 💡 **Notes**
216+
217+
- 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).
218+
- The dark mode toggle is handled with React state and applied to various components via Material-UI's `ThemeProvider`.
219+
220+
## 🧪 **Testing**
221+
222+
### **Running Tests**
223+
224+
This project includes a few basic tests for the API endpoints and utility functions. To run the tests, use the following command:
225+
226+
```bash
227+
npm run test
228+
```
229+
230+
Or, if using Yarn:
231+
232+
```bash
233+
yarn test
234+
```
235+
236+
The tests will run and display the results in the terminal.
237+
238+
## 🔧 **Contributing**
18239

19-
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
240+
Contributions are welcome! If you'd like to contribute, please fork the repository, make your changes, and create a pull request.
20241

21-
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
242+
## 📝 **License**
22243

23-
## Learn More
244+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.
24245

25-
To learn more about Next.js, take a look at the following resources:
246+
## 📧 **Contact**
26247

27-
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28-
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
248+
For any inquiries or feedback, feel free to reach out to the author at `[email protected]`.
29249

30-
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
250+
Enjoy using the **ToDo-App-Fullstack-NextJS**! 🎉
31251

32-
## Deploy on Vercel
252+
---
33253

34-
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
254+
Happy coding! 🚀
35255

36-
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
256+
[Back to Top ↑](#todo-app-fullstack-nextjs)

docker-compose.yml

Whitespace-only changes.

images/home-bright.png

253 KB
Loading

images/home-dark.png

230 KB
Loading

images/landing-bright.png

328 KB
Loading

images/landing-dark.png

312 KB
Loading

images/login-bright.png

191 KB
Loading

images/login-dark.png

175 KB
Loading

images/register-bright.png

207 KB
Loading

images/register-dark.png

190 KB
Loading

0 commit comments

Comments
 (0)