A modern, real-time client portal built with the MERN stack, designed to work seamlessly in both China and the US without requiring a VPN. Features include form submissions, real-time updates, user management, and admin dashboards.
- Cross-Region Access: Optimized for both China and US regions
- Real-Time Updates: Live data synchronization using Socket.io
- Form Management: Create and manage dynamic forms
- User Management: Role-based access control with permissions
- Admin Dashboard: Comprehensive analytics and management tools
- Responsive Design: Works on desktop and mobile devices
- Secure Authentication: JWT-based authentication with role permissions
- Node.js with Express.js
- MongoDB with Mongoose
- Socket.io for real-time communication
- JWT for authentication
- Helmet for security
- Express Rate Limiting for API protection
- React with TypeScript
- React Router for navigation
- Axios for API calls
- Socket.io Client for real-time updates
- CSS3 with modern styling
- Node.js (v14 or higher)
- MongoDB (local or cloud instance)
- npm or yarn
git clone <repository-url>
cd client-portalnpm installcd client
npm installcp env.example .envEdit .env with your configuration:
# Database
MONGODB_URI=mongodb://localhost:27017/client-portal
# JWT
JWT_SECRET=your-super-secret-jwt-key-here
JWT_EXPIRE=7d
# Server
PORT=5000
NODE_ENV=development
REGION=us
# Client URL
CLIENT_URL=http://localhost:3000cd client
cp env.example .envEdit client/.env:
REACT_APP_API_URL=http://localhost:5000/api
REACT_APP_SOCKET_URL=http://localhost:5000# Start backend (from root directory)
npm run dev
# Start frontend (from client directory)
cd client
npm start# Build frontend
npm run build
# Start production server
npm start- Hosting: AWS, Google Cloud, or DigitalOcean
- Database: MongoDB Atlas (US region)
- CDN: CloudFlare or AWS CloudFront
- Hosting: Alibaba Cloud, Tencent Cloud, or AWS China
- Database: MongoDB Atlas (Asia Pacific region)
- CDN: Alibaba Cloud CDN or Tencent Cloud CDN
-
Set up MongoDB Atlas:
- Create clusters in both US and China regions
- Configure replica sets for high availability
- Set up proper security groups
-
Deploy Backend:
# Build and deploy to your hosting provider npm run build -
Deploy Frontend:
cd client npm run build # Deploy build folder to CDN/hosting
-
Environment Variables:
- Set production environment variables
- Configure CORS for cross-region access
- Set up SSL certificates
- Database Indexing: Ensure proper indexes on frequently queried fields
- CDN Configuration: Use regional CDNs for static assets
- Caching: Implement Redis for session and data caching
- Load Balancing: Use load balancers for high availability
POST /api/auth/login- User loginPOST /api/auth/register- User registrationGET /api/auth/me- Get current userPUT /api/auth/profile- Update profilePUT /api/auth/change-password- Change password
GET /api/forms- Get all formsPOST /api/forms- Create new formGET /api/forms/:id- Get single formPUT /api/forms/:id- Update formDELETE /api/forms/:id- Delete form
GET /api/submissions- Get all submissionsPOST /api/submissions- Create new submissionGET /api/submissions/:id- Get single submissionPUT /api/submissions/:id- Update submissionPOST /api/submissions/:id/notes- Add note to submission
GET /api/users- Get all usersPOST /api/users- Create new userPUT /api/users/:id- Update userDELETE /api/users/:id- Delete user
- JWT Authentication: Secure token-based authentication
- Role-Based Access Control: Admin, User, and Viewer roles
- Permission System: Granular permissions for different actions
- Rate Limiting: API rate limiting to prevent abuse
- Input Validation: Server-side validation for all inputs
- CORS Configuration: Proper cross-origin resource sharing
- Helmet Security: Security headers and protection
- Modern Design: Clean, professional interface
- Responsive Layout: Works on all device sizes
- Real-Time Updates: Live data synchronization
- Intuitive Navigation: Easy-to-use navigation system
- Accessibility: WCAG compliant design
- Dashboard Analytics: Overview of system statistics
- User Management: Create, edit, and manage users
- Form Management: Create and configure forms
- Submission Tracking: Monitor and manage submissions
- Real-Time Monitoring: Live updates and notifications
client-portal/
βββ models/ # MongoDB models
βββ routes/ # API routes
βββ middleware/ # Custom middleware
βββ client/ # React frontend
β βββ src/
β β βββ components/ # React components
β β βββ contexts/ # React contexts
β β βββ services/ # API services
β β βββ types/ # TypeScript types
β βββ public/ # Static assets
βββ server.js # Main server file
βββ package.json # Dependencies
npm start- Start production servernpm run dev- Start development server with nodemonnpm run client- Start React development server
npm start- Start React development servernpm run build- Build for productionnpm test- Run tests
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.
For support and questions:
- Create an issue in the repository
- Contact the development team
- Check the documentation
The application includes real-time updates for:
- New form submissions
- Submission status changes
- User activity
- System notifications
- No VPN Required: Works in both China and US
- Fast Performance: Optimized for cross-region access
- Real-Time: Live updates like Google Sheets
- Secure: Enterprise-grade security
- Scalable: Built to handle growth
- User-Friendly: Intuitive interface for all users