|
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 | +# Full-stack App Demo |
2 | 2 |
|
3 |
| -## Getting Started |
| 3 | +## Purpose |
4 | 4 |
|
5 |
| -First, run the development server: |
| 5 | +This project demonstrates a fully working task management app built using NextJS and TypeScript. The app is deployed live on Vercel at https://code-differently-24-q4.vercel.app/ |
| 6 | + |
| 7 | +## Running the app |
| 8 | + |
| 9 | +To run the app, copy the [.env.example](./.env.example) file as `.env` and setup the Clerk keys by setting up an account at https://clerk.dev. Once done, you can start up the local dev server with the following commands: |
6 | 10 |
|
7 | 11 | ```bash
|
| 12 | +npm install |
8 | 13 | npm run dev
|
9 |
| -# or |
10 |
| -yarn dev |
11 |
| -# or |
12 |
| -pnpm dev |
13 |
| -# or |
14 |
| -bun dev |
15 | 14 | ```
|
16 | 15 |
|
17 |
| -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. |
| 16 | +## Architecture |
| 17 | + |
| 18 | +The app is built using the React library running on the NextJS framework. The homepage is located at [src/app/page.tsx](./src/app/page.tsx) and contains the main `TodoApp` component. |
18 | 19 |
|
19 |
| -You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. |
| 20 | +The `TodoApp` component and sub-components uses `fetch` to get data from the backend API which is located at [src/app/api/todos/route.ts](./src/app/api/todos/route.ts). |
20 | 21 |
|
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. |
| 22 | +The backend API gets a repository instance from [src/repositories/index.ts](./src/repositories/index.ts), using an environment variable to choose between a JSON repository implementation or a Redis version. For more on the repository pattern, [see this article on Medium](https://medium.com/@pererikbergman/repository-design-pattern-e28c0f3e4a30). |
22 | 23 |
|
23 |
| -## Learn More |
| 24 | +## Connecting to Redis |
24 | 25 |
|
25 |
| -To learn more about Next.js, take a look at the following resources: |
| 26 | +By default, the app is configured to store data on the web server in a JSON file (./src/repositories/db.json). You can connect it to a Redis database by creating one on Vercel (called Upstash KV). Then, set the `DB_TYPE` to `redis` in the `.env` file and configure the additional config keys listed in `.env.example.redis`. |
26 | 27 |
|
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. |
| 28 | +## Deploying live |
29 | 29 |
|
30 |
| -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome! |
| 30 | +To deploy this app, sign up for an account on Vercel and create a project pointing to your fork of this repo. You'll need to configure the environment variables you setup in your local `.env` file using the Vercel UI. |
31 | 31 |
|
32 |
| -## Deploy on Vercel |
| 32 | +## Tools |
33 | 33 |
|
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. |
| 34 | +Here are a list of tools used to compile this demo. You can read the official documentation to learn how various aspects of the demo function. |
35 | 35 |
|
36 |
| -Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details. |
| 36 | +* NextJS (https://nextjs.org) |
| 37 | +* Vercel (https://vercel.com) |
| 38 | +* Clerk (https://clerk.dev) |
| 39 | +* React (https://react.dev) |
| 40 | +* LowDB (https://github.com/typicode/lowdb) |
| 41 | +* Upstash Redis (https://upstash.com/docs/redis/overall/getstarted) |
0 commit comments