A full-stack application built with Next.js frontend and NestJS backend, implementing user authentication functionality.
frontend/
: Next.js applicationbackend/
: NestJS application
- Node.js (Latest LTS version recommended)
- MongoDB installed and running locally
- npm or yarn package manager
-
Navigate to the backend directory:
cd backend
-
Install dependencies:
npm install
-
Create a
.env
file in the backend directory with the following content:PORT=3001 MONGO_URI=mongodb://localhost/nest JWT_SECRET=secret JWT_EXPIRATION=3d
-
Start the development server:
npm run start:dev
The backend server will start on http://localhost:3001.
API documentation can be found on http://localhost:3001/api
-
Navigate to the frontend directory:
cd frontend
-
Install dependencies:
npm install
-
Create a
.env
file in the frontend directory with the following content:NEXT_PUBLIC_DUMMY_API_URL=https://dummyjson.com NEXT_PUBLIC_BASE_API_URL=http://localhost:3001
-
Start the development server:
npm run dev
The frontend application will be available at http://localhost:3000
npm run start
: Start the production servernpm run start:dev
: Start the development server with hot-reloadnpm run build
: Build the applicationnpm run test
: Run testsnpm run lint
: Lint and fix files
npm run dev
: Start the development servernpm run build
: Build the applicationnpm run start
: Start the production servernpm run lint
: Lint and fix files
PORT
: The port number for the backend serverMONGO_URI
: MongoDB connection stringJWT_SECRET
: Secret key for JWT token generationJWT_EXPIRATION
: JWT token expiration time
NEXT_PUBLIC_DUMMY_API_URL
: URL for the dummy API serviceNEXT_PUBLIC_BASE_API_URL
: URL for the backend API
⚠️ Disclaimer: The.env
files shown above are included for demonstration purposes only. In a production environment, these files should never be committed to version control. Make sure to add.env
to your.gitignore
file and maintain proper environment variable management for your production deployments.