This is a simple note-taking application with CRUD operations and authentication.
To access the live version of this project, click here.
- Create, Read, Update, and Delete notes (CRUD operations)
- User authentication
- User-friendly interface
- Backend: NestJS
- Database: MongoDB
- Frontend: NextJS
- Authentication: JSON Web Tokens (JWT), Next Auth
- Deployment: Vercel (for NextJS) and AWS Lambda (for NestJS)
Before you begin, ensure you have met the following requirements:
- Node.js installed on your machine
- MongoDB installed and running or Mongo atlas URI
- A code editor of your choice
-
Clone the repository:
git clone https://github.com/amresh-kumar-singh/quick-note.git
-
Navigate to project directroy:
cd quick-note
-
Navigate to server directroy:
cd server -
Install dependencies:
npm install
-
Set up environment variables:
MONGO_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret PORT=8000
-
Navigate to client directroy:
cd client -
Install dependencies:
npm install
-
Set up environment variables:
NEXTAUTH_SECRET=your_next_auth_secret NEXTAUTH_URL=your_next_auth_url NEXT_PUBLIC_SERVER_PATH=your_url_to_api
-
Navigate to server directroy:
cd server -
Start:
npm run start:dev
-
Navigate to client directroy:
cd client -
Start:
npm run dev
-
Sign up or log in to Vercel on their website.
-
Once logged in, click on the "Add New" button on the dashboard and select "Project".
-
Import Git repository of project. Connect your git repository if not connected already to vercel.
-
Click on import button next to your project.
-
A new prompt will open.
- Select Project name(by default git project name is selected).
- Choose framework preset from dropdown if not selected already.
- Click "Edit" and choose client as root directory.
- Add your "Environment Variable".
- Click "Deploy".
Note: Please create a local build using npm run build to check for any errors that may occur during the project's compilation.
There are multiple ways to deploy an application on AWS Lambda, but for this project, we will utilize the serverless package for deployment. Additionally, serverless offline functionality allows us to test the deployment locally.
-
First we will install few production and development dependencies in our server root:
npm i @codegenie/serverless-express aws-lambda npm i -D @types/aws-lambda serverless-offline
-
After installation create serverless.yml file to configure the Serverless framework.
-
The project's entry point is main.ts, where the application listens on a specific port. We will leave main.ts unchanged and create a new file serverless.ts, which will serve as the entry point for the serverless functions.
-
In the serverless.yml file, the main entry point for the function is defined as follows:
functions: main: handler: dist/serverless.handler -
Open up the tsconfig.json file and make sure to enable the esModuleInterop option to make the @codegenie/serverless-express package load properly:
{ "compilerOptions": { ... "esModuleInterop": true } } -
To test our deployment set up works locally first create build and deploy application using commands:
npm run build npx serverless offline
-
If our local deployment works fine, we can proceed with AWS deployment. To do so, we need to add AWS credentials to our system, which can be accomplished using"
npx serverless config credentials --provider aws --key <Access Key ID> --secret <Secret Access Key>
-
Deploy application on AWS Lambda:
npx serverless deploy --stage prod
-
Additionally to check server logs:
npx serverless logs -f main --stage prod
This project is licensed under the MIT.