BackendAstro is the Express and MongoDB backend used for the Astro portfolio platform. It powers authentication, blog management, booking slots, visitor submissions, and category-based content filtering.
- Admin registration and login with hashed passwords
- Slot creation and slot booking workflows
- Visitor data submission and retrieval
- Blog creation, listing, filtering, detail lookup, and deletion
- Blog category creation and category listing
- Node.js
- Express
- MongoDB
- Mongoose
- bcryptjs
- CORS
- dotenv
BackendAstro/
|-- index.js # Express app, schemas, and route handlers
|-- package.json # Dependencies and scripts
The server defines and uses these main MongoDB models:
User- admin credentialsSlot- appointment date, time range, mode, and booking stateData- visitor or lead submissionsBlog- blog content, image, category, timestampsCategory- reusable blog categories
POST /api/registerPOST /api/login
POST /api/slotsGET /api/slotsPOST /api/slots/book
POST /dataGET /api/latestdataGET /getData
GET /api/blogsPOST /api/blogsGET /api/blogs/:idDELETE /api/blogs/:idGET /api/blogsfilterGET /api/categoriesPOST /add-categoryGET /api/getcategories
git clone https://github.com/Deepakraja03/BackendAstro.git
cd BackendAstro
npm install
npm run devCreate a .env file in the project root.
DB=your_mongodb_connection_string
PORT=5000- The code currently keeps schemas and routes in a single
index.jsfile for simplicity - CORS is configured for the deployed portfolio frontend and local development
- Booking works by pairing stored visitor submission data with an available slot record
- Split routes, models, and middleware into separate folders
- Add request validation for public endpoints
- Return auth tokens for protected admin actions
- Add tests for blog and slot flows
- Add centralized error handling and logging