A Node.js-based blogging platform with full CRUD functionality, user authentication, comments, and post management.
- User registration & authentication (sessions or JWT)
- Create, read, update, delete (CRUD) blog posts
- Add and manage comments on posts
- Fetch posts and comments by ID
- Clean project structure (configs, middleware, models, routes, services)
- Ready for future enhancements like templating or frontend integration
blog-platform/
├── configs/ # Configuration files (DB, environment)
├── middleware/ # Authentication, error handling, etc.
├── models/ # Data models (Posts, Users, Comments)
├── routes/ # API endpoints
├── services/ # Business logic & utilities
├── app.js # Entry point / server setup
├── index.js # Application bootstrap
├── package.json # Project metadata
└── README.md # Project documentation- Clone the repository
git clone https://github.com/addzz24/blog-platform.git cd blog-platform - Install dependencies
npm install
- Set up environment variables (Create New .env file in your root directory)
PORT=3000 DATABASE_URL=your_database_url JWT_SECRET=your_secret
- Run the server
Run the server
npm startThe server should now be running at http://localhost:3000
-
Server configuration
PORT=3000 -
Database connection
DATABASE_URL=postgres://user:password@localhost:5432/blogdb -
JWT secret for authentication
JWT_SECRET=supersecretkey
-
Register and authenticate users
-
Create, update, and delete posts
-
Add and manage comments
-
Query posts and comments by ID