A full-stack workspace booking platform built with React, Express.js, and PostgreSQL. DevLabs provides a complete innovation workspace platform with user authentication, workspace management, reservation system, and review functionality.
- Backend API: Ready for deployment to Render.com
- Frontend: Ready for deployment to Render.com
- Framework: Express.js
- Database: PostgreSQL (Render)
- ORM: Sequelize
- Authentication: JWT + bcrypt
- Security: CORS, CSRF, Helmet
- Framework: React 18
- Build Tool: Vite
- State Management: Redux
- Routing: React Router v6
- Styling: CSS3
- User Authentication: Registration, login, logout with JWT
- Workspace Management: CRUD operations for workspace listings
- Reservation System: Date-based workspace bookings with validation
- Review System: Workspace reviews with ratings and images
- Image Management: Support for workspace and review images
- Security: CSRF protection, password hashing, input validation
Tables:
- Users: Authentication and profile data
- Spots: Workspace listings with location and details
- Bookings: Workspace reservations with date validation
- Reviews: User reviews with ratings (1-5 stars)
- SpotImages: Workspace image management
- ReviewImages: Review image attachments
-
Create PostgreSQL Database:
- Go to Render.com dashboard
- Create new PostgreSQL database
- Copy connection details
-
Deploy Backend Service:
- Connect GitHub repository
- Set build command:
npm install
- Set start command:
npm start
- Set environment variables (see .env.example)
-
Environment Variables:
DB_USERNAME=your_render_db_username DB_PASSWORD=your_render_db_password DB_DATABASE=your_render_db_name DB_HOST=your_render_db_host DATABASE_URL=postgresql://username:password@host/database JWT_SECRET=your_secure_jwt_secret JWT_EXPIRES_IN=604800 PORT=8001 NODE_ENV=production
-
Run Database Setup (after deployment):
# Migrations and seeders run automatically on deployment # Or manually via Render shell: npm run sequelize db:migrate npm run sequelize db:seed:all
-
Create Static Site:
- Connect GitHub repository
- Set build command:
npm run build
- Set publish directory:
dist
- Set root directory:
frontend
-
Environment Variables:
VITE_API_URL=https://your-backend-service.onrender.com
- Node.js 18+
- PostgreSQL (local or remote)
- Git
-
Clone and Install:
git clone <repository-url> cd DevLabs-Demo/backend npm install
-
Environment Configuration:
cp .env.example .env # Edit .env with your database credentials
-
Database Setup:
# Create database npm run sequelize db:create # Run migrations npm run sequelize db:migrate # Seed demo data npm run sequelize db:seed:all
-
Start Development Server:
npm start # Backend runs on http://localhost:8001
-
Install Dependencies:
cd frontend npm install
-
Start Development Server:
npm run dev # Frontend runs on http://localhost:5173
DevLabs-Demo/
βββ backend/
β βββ config/
β β βββ database.js # Database configuration
β βββ db/
β β βββ migrations/ # Database schema migrations
β β βββ models/ # Sequelize models
β β βββ seeders/ # Demo data seeders
β βββ routes/
β β βββ api/ # API route handlers
β β β βββ session.js # Authentication routes
β β β βββ users.js # User management
β β β βββ spots.js # Property routes
β β β βββ bookings.js # Booking routes
β β β βββ reviews.js # Review routes
β β βββ index.js # Route configuration
β βββ utils/ # Helper functions
β βββ app.js # Express application setup
β βββ package.json # Backend dependencies
βββ frontend/
β βββ src/
β β βββ components/ # Reusable React components
β β βββ pages/ # Page-level components
β β βββ store/ # Redux store configuration
β β βββ context/ # React context providers
β β βββ App.js # Main application component
β βββ dist/ # Production build output
β βββ vite.config.js # Vite configuration
β βββ package.json # Frontend dependencies
βββ .gitignore # Git ignore rules
βββ .env.example # Environment template
βββ README.md # This file
- JWT Authentication: Secure token-based authentication
- Password Hashing: bcrypt with salt for password security
- CSRF Protection: Cross-site request forgery prevention
- CORS Configuration: Properly configured for production
- Input Validation: Server-side validation for all endpoints
- SQL Injection Prevention: Sequelize ORM protection
- Environment Variables: Sensitive data stored securely
- POST
/api/session
- Body:
{ "credential": "email_or_username", "password": "password" }
- Success: Returns user object and JWT token
- POST
/api/users
- Body:
{ "firstName": "John", "lastName": "Doe", "email": "john@example.com", "username": "johndoe", "password": "password" }
- DELETE
/api/session
- Auth Required: Yes
- GET
/api/session
- Auth Required: Yes
- GET
/api/spots
- Query Params:
page
,size
,minLat
,maxLat
,minLng
,maxLng
,minPrice
,maxPrice
- GET
/api/spots/:spotId
- Returns: Spot details with images, owner info, and average rating
- POST
/api/spots
- Auth Required: Yes
- Body: Spot details (address, city, state, country, lat, lng, name, description, price)
- PUT
/api/spots/:spotId
- Auth Required: Yes (Owner only)
- DELETE
/api/spots/:spotId
- Auth Required: Yes (Owner only)
- GET
/api/bookings/current
- Auth Required: Yes
- POST
/api/spots/:spotId/bookings
- Auth Required: Yes
- Body:
{ "startDate": "2024-01-01", "endDate": "2024-01-07" }
- PUT
/api/bookings/:bookingId
- Auth Required: Yes (Booking owner only)
- DELETE
/api/bookings/:bookingId
- Auth Required: Yes (Booking owner only)
- GET
/api/spots/:spotId/reviews
- POST
/api/spots/:spotId/reviews
- Auth Required: Yes
- Body:
{ "review": "Great place!", "stars": 5 }
- PUT
/api/reviews/:reviewId
- Auth Required: Yes (Review owner only)
- DELETE
/api/reviews/:reviewId
- Auth Required: Yes (Review owner only)
cd backend
npm test
cd frontend
npm test
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Create an issue in the GitHub repository
- Contact the DevLabs development team
- β Backend: Production-ready with PostgreSQL integration
- β Database: Migrations and seeders configured
- β Security: JWT authentication and CSRF protection implemented
- β API: All CRUD endpoints functional
β οΈ Frontend: Build ready (deployment pending path resolution)