This is a full-stack web application for customizing user onboarding flows. Admins can control which fields appear on specific steps of the onboarding process, while users can fill out the forms.
- Features
- Tech Stack
- Setup and Installation
- API Endpoints
- Running the App
- Admin Configuration
- Users Data
- User Onboarding Wizard: A three-step onboarding process where users can input email, password, personal details, and more.
- Admin Configuration: Admins can customize which fields appear on step 2 and step 3 of the onboarding wizard.
- Data Persistence: User data is stored in MongoDB and can be displayed in a simple HTML table.
- Frontend: Next.js (React), TypeScript, CSS Modules
- Backend: Node.js, Express.js
- Database: MongoDB (MongoClient)
- State Management: React's
useState
anduseEffect
- API Communication: Fetch API for frontend-backend communication
Make sure you have the following installed on your machine:
- Node.js
- npm or yarn
- MongoDB
-
Clone the repository:
git clone https://github.com/abdelmaoulagr/custom-onboarding-flow.git cd custom-onboarding-flow
-
Install dependencies:
- In the project root directory, run:
npm install
- Install dependencies for both the frontend and backend:
cd backend npm install cd ../frontend npm install
-
Environment Variables:
- Create a
.env
file in thebackend/
directory with the following:
MONGO_URI=<your-mongodb-connection-string>
- Create a
-
Database Setup:
- Make sure MongoDB is running on your machine or connect to a MongoDB Atlas cluster.
- PUST /api/users/register: Registers a new user with email and password.
- PUT /api/users/addInfos: Adds personal information ( address, about me, birthdate) for a user.
- GET /api/users/allUsers: Fetches all users data.
- GET /api/adminConfig: Fetches the admin configuration for steps 2 and 3.
- PUT /api/adminConfig: Updates the admin configuration.
- Start the backend server: In the
backend/
directory, run:npm run dev
- Start the frontend server: In the frontend/ directory, run:
npm run dev
- Access app:
- Frontend: http://localhost:3000
- Backend API: http://localhost:5000
The onboarding process can be customized by updating the admin configuration stored in the database. By default, the configuration is:
{
"step2": ["aboutMe", "address"],
"step3": ["birthday"]
}
To update the configuration:
- Go to /admin and make your selections.
- Submit the form to update which components are shown in each step of the onboarding process.
All registered users' data can be viewed by accessing the /data
endpoint. This page displays a simple HTML table with user information.
Access the Users Data:
- URL: /data
- Method: GET
- Description: Fetches and displays all users' information stored in the database. No authentication is required for accessing this page.