Welcome to the Next.js Full-Stack Blog! This project is a blog application built using Next.js. Follow the instructions below to set up and run the project.
- Create, read, update, and delete blog posts
- Server-side rendering for better SEO and initial load performance
- Client-side rendering for dynamic user interactions
- Dockerized setup for easy database deployment
Before you begin, ensure you have the following software installed on your machine:
- Node.js (version 14.x or later)
- npm (comes with Node.js) or Yarn
- Docker (for containerized environment)
- Docker Compose
- Clone the repository:
clone the repo to your local device
- Install dependencies:
Using npm:
npm install
Using Yarn:
yarn install
- Environment Variables:
Create a
.env
file in the thinkblog directory of the project and add the following environment variables:GOOGLE_CLIENT_ID="" GOOGLE_CLIENT_SECRET="" POSTGRES_PASSWORD="" POSTGRES_USER="" POSTGRES_DB="" DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:5432/${POSTGRES_DB}?schema=public"
- Docker Compose:
Ensure you have Docker and Docker Compose installed. Use the provided
docker-compose.yml
file to set up the database and other services.Start the services using Docker Compose:
docker compose up
This command will start the database and any other services defined in the
docker-compose.yml
file.
- Development:
Start the development server:
Using npm:
npm run dev
Using Yarn:
yarn dev
Open your browser and navigate to http://localhost:3000 to see the application in action.
- Production:
Build the application for production:
Using npm:
npm run build npm start
Using Yarn:
yarn build yarn start
This will start the application in production mode. Make sure to adjust environment variables for production as needed.
Welcome to the Next.js Full-Stack Blog! This project is a blog application built using Next.js. Follow the instructions below to set up and run the project.
- Create, read, update ...