- Project Overview
- Quick Links
- Backend
- Frontend: CodeGeekCentral-CMS
- Frontend: CodeGeekCentral (Main Site)
- Upcoming Features
- Dependency Graph
- Contributing
- Credits
Welcome to CodeGeekCentral, your comprehensive blogging platform that brings together bloggers, readers, and content enthusiasts. CodeGeekCentral is a JAMstack-powered platform, empowers users to share their thoughts, explore exciting content, and engage with the community. Whether you're a seasoned writer or an avid reader, CodeGeekCentral is your go-to destination for all things blogs.
CodeGeekCentral's backend is built with Node.js, Express.js, and MongoDB. It offers a set of powerful API endpoints to manage users, blogs, comments, authentication, and file uploads.
- User Endpoint
- Blogs Endpoint
- Comments Endpoint
- Auth Endpoint
- Upload Endpoint
For detailed information about each endpoint, refer to our Postman API Documentation.
- Authentication: Secure authentication with JWT. Refresh tokens are stored in HTTP-only cookies, and access tokens are included in API responses.
- Security Measures: Robust query sanitization, data validation using Express Validator, and cascade delete for dependent Mongoose models.
- File Upload: Utilizes Multer for server-side file processing, validation, and Cloudinary integration for storing and processing images.
- Role-Based Access Control (RBAC): Assigning roles to users for access control.
- Performance: Implementing indexing for efficient data retrieval. Supports pagination for large datasets.
- Hosting: The server is hosted on CodeGeekCentral Server.
CodeGeekCentral's Content Management System (CMS) is built with Vite-React, TypeScript, React Router, and Tailwind CSS. It provides a user-friendly interface for bloggers to manage their content and profile.
- Routes: Extensive routing for user authentication, profile management, blog creation, editing, and more.
- Validation: Comprehensive form validation to ensure data integrity and security.
- State Management: Access tokens stored securely in state for protection against XSS and CSRF.
- Custom Hooks: Utilizes custom hooks for improved code organization.
- Profile Section: Supports profile avatar upload with URL or file upload options.
- User Access Control: Strict access control ensures only authors can edit their posts.
CodeGeekCentral's main site is built with Next.js, offering SEO-friendly routes and features like SSG, ISR, and SSR for optimal performance.
- Routes: Optimized for reading and commenting.
- SSG: Key routes are statically generated for efficient delivery.
- Revalidation Time: Frequent data change routes revalidate every 1 minute, while blogs revalidate every 1 hour.
We have exciting plans for the future, including:
- Search and Discovery: Implement advanced search and discovery functionalities to help users find relevant content.
- Featured Section: Showcase top-rated and handpicked blog posts to provide users with a curated reading experience.
We welcome contributions from the community! If you'd like to get involved, please follow our Contribution Guidelines to help us improve CodeGeekCentral.
If you intend to work on the backend of CodeGeekCentral, follow these steps:
-
Clone the CodeGeekCentral repository:
git clone https://github.com/karprabha/blog-api
-
Change your working directory to the backend:
cd blog-api/backend
-
Rename the `.env.example` file to `.env` and configure the following environment variables:
MONGODB_URI=your_mongodb_uri CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name CLOUDINARY_API_KEY=your_cloudinary_api_key CLOUDINARY_API_SECRET=your_cloudinary_api_secret JWT_SECRET=your_jwt_secret REFRESH_TOKEN_SECRET=your_refresh_token_secret ACCESS_TOKEN_EXPIRY=your_access_token_expiry REFRESH_TOKEN_EXPIRY=your_refresh_token_expiry COOKIE_MAX_AGE=your_cookie_max_age NODE_ENV=development MORGAN_LOG_FORMAT=dev CMS_URI=http://localhost:5173 CLIENT_URI=http://localhost:5000
-
Generate new values for JWT_SECRET and REFRESH_TOKEN_SECRET using:
node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"
-
To start the development server, run:
npm run dev
For CMS development, these are the steps:
-
Clone the CodeGeekCentral repository:
git clone https://github.com/karprabha/blog-api
-
Change your working directory to the CMS frontend:
cd blog-api/frontend/cms
-
Rename the `.env.example` file to `.env` and set your environment variables:
VITE_API_URI=http://localhost:3000 VITE_DEMO_USERNAME=your_demo_username VITE_DEMO_PASSWORD=your_demo_password
-
To start the development server, run:
npm start
For working on the main site:
-
Clone the CodeGeekCentral repository:
git clone https://github.com/karprabha/blog-api
-
Change your working directory to the main site frontend:
cd blog-api/frontend/codegeekcentral
-
Rename the `.env.local.example` file to `.env.local` and configure the following environment variables:
NEXT_PUBLIC_API_URI=http://localhost:3000 NEXT_PUBLIC_GA_MEASUREMENT_ID=your_ga_measurement_id
-
To start the server, run:
npm run dev
This project is licensed under the MIT License - see the LICENSE file for details.
We'd like to express our gratitude to the following resources:
- Cloudinary: We've utilized Cloudinary to manage files like user avatar.
Your contributions have made this project truly special!