Pog Blog is a social media blogging platform similar to Medium, where users can write, share, and discover articles on a variety of topics. Built using modern web development technologies, it consists of a client (frontend) and server (backend) that work together to deliver a seamless user experience.
- User authentication and authorization
- Create, edit, and delete blog posts
- Follow other users and engage with content
- Full-text search functionality
- Email notifications for followers
- Responsive design with Tailwind CSS
- Node.js with Express
- MongoDB for data storage
- Lucia Auth for authentication
- Nodemailer for email verification
- TypeScript for static typing
- Vite for fast development and build setup
- React for building the UI
- Tailwind CSS for styling
- TypeScript for better type safety
- PostCSS for CSS processing
- Node.js (v16 or higher)
- MongoDB instance
- Vercel CLI (for deployment, if needed)
-
Clone the repository:
git clone https://github.com/Fexxix/pog-blog.git cd pog-blog/server
-
Install server dependencies:
npm install
-
Set up environment variables: Create a
.env
file in theserver
directory and populate it with the following variables:PORT=3000 MONGO_URI=YOUR_MONGO_URI NODE_ENV=development CLIENT_URL=http://localhost:5173 SMTP_HOST=smtp.gmail.com SMTP_PORT=465 SMTP_SERVICE=gmail SMTP_USER=YOUR_EMAIL SMTP_PASSWORD=YOUR_SMTP_PASSWORD
-
Run the server in development mode:
npm run dev
This will start the server on
http://localhost:3000
.
-
Navigate to the
client
directory:cd ../client
-
Install client dependencies:
npm install
-
Start the client development server:
npm run dev
The client will be accessible at
http://localhost:5173
.
To create a production build of the client:
npm run build
The output will be available in the dist
directory.
The application requires the following environment variables to run. Make sure to create a .env
file with these values.
PORT=3000
MONGO_URI=YOUR_MONGO_URI
NODE_ENV=development
CLIENT_URL=http://localhost:5173
SMTP_HOST=smtp.gmail.com
SMTP_PORT=465
SMTP_SERVICE=gmail
SMTP_USER=YOUR_EMAIL
SMTP_PASSWORD=YOUR_SMTP_PASSWORD
-
Create a MongoDB instance:
- You can either install MongoDB locally from here or use a cloud service like MongoDB Atlas.
-
Get the MongoDB URI:
- For a local instance, use
mongodb://localhost:27017/pog-blog
. - For MongoDB Atlas, follow their steps to create a database and get your connection string, typically in this format:
mongodb+srv://<username>:<password>@cluster0.mongodb.net/pog-blog?retryWrites=true&w=majority
- For a local instance, use
-
Update the
.env
file with theMONGO_URI
:MONGO_URI=mongodb+srv://<username>:<password>@cluster0.mongodb.net/pog-blog?retryWrites=true&w=majority
-
Create a Gmail account (or use an existing one) to send emails via Nodemailer.
-
Enable “Less secure app access”: Go to your Gmail account's security settings and enable access for less secure apps, or create an App Password.
-
Update the
.env
file with SMTP details:SMTP_HOST=smtp.gmail.com SMTP_PORT=465 SMTP_SERVICE=gmail SMTP_USER=your-email@gmail.com SMTP_PASSWORD=your-app-password
This will allow your app to send email notifications.