Blog app is a application where users should be authenticated and post blogs. The application allow users to view all the blog posts and filter/search blogs of specific author's blog by his/her author ID.
In this application, users can publish and view their blogs. The application also allows users to filter blogs posts by author's author ID.
- User Registration: Users can sign up by providing their name, email, and password.
- User Login: Existing users can log in to their account using their email and password.
- Data fetching: Data is fetched on the homepage and search author page using server-side rendering.
- Blog Viewing: Users can access all blogs on the homepage and their personal blogs on dashboard.
- Blog Filtering/Searching: Users can filter/search specific author's blog by author ID.
- Protected Routes: Only logged-in users can access the homepage, dashboard and create blogs.
- Used Prisma as ORM to interact with Postgres database and to store the data in db.
Here is the deployed website : Deployed Link
Here is the deployed backend server: Backend Link;
To install and run this project locally, add the following commands in your terminal, follow these steps:
-
Clone the repository from GitHub:
`git clone https://github.com/omkargade04/Blog-App.git`
-
Navigate into the project directory:
`cd Blog-App`
- Navigate into client:
`cd client`
- Navigate into server:
`cd server`
- Ensure that the version of
Node.js
andnpm
you're using is compatible with the dependencies you're installing. Some dependencies may require specific Node.js versions. Run the below command in client directory and server directory.
`npm install -g npm@latest`
- Install
dependencies
for the frontend in client directory (assuming you haveNode.js
andnpm
installed):
`npm install`
- Install
dependencies
for the backend in server directory (assuming you haveNode.js
andnpm
installed):
`npm install`
- Install
prisma
for the database ORM in server directory
`npx prisma init`
- Setup the database by running the migration command
`npx prisma migrate dev --name init`
- Create a .env file in the client directory and add backend api endpoint:
NEXT_PUBLIC_BASEURL
=http://localhost:5000
(for local server)
NEXT_PUBLIC_BASEURL
=https://blog-app-n9f2.onrender.com
(for deployed server)
- Create a .env file in the server directory and connect your database with prisma via database url:
PORT
=5000
DATABASE_URL
=postgresql://<user>:<password>@localhost:5432/<db_name>?schema=public
TOKEN_SECRET
=your-token
-
Start the frontend and backend servers:
server:
npm run dev
client:npm run dev
-
Open
http://localhost:3000
to view the application.
- Docker
To install Docker, run the following commands in your terminal:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
- Navigate into server directory
- To get started with development first build the dev containers using the following command
docker-compose -f docker-compose-server.yaml build
- The env file being used for development is called
.env
- Run the containers using the command
docker-compose -f docker-compose-server.yaml up
- Navigate into client directory
- To get started with development first build the dev containers using the following command
docker-compose -f docker-compose-client.yaml build
- The env file being used for development is called
.env
- Run the containers using the command
docker-compose -f docker-compose-client.yaml up