A modern, UX-focused multi-step onboarding flow with draft save, conditional logic, and resume later features.
- Multi-Step Wizard: Profile -> Company -> Preferences -> Done
- Draft Save: Automatically saves progress at each step
- Resume Later: Users can close and return to continue where they left off
- Conditional Logic: Skip steps based on user selections (e.g., skip preferences if company has existing tools)
- Beautiful UI: Modern, responsive design with smooth animations
- Validation: Real-time form validation with helpful error messages
- API Documentation: OpenAPI/Swagger documentation included
- Django 4.2 - Python web framework
- Django REST Framework - API development
- PostgreSQL - Database
- drf-spectacular - OpenAPI documentation
- Next.js 14 - React framework
- TypeScript - Type safety
- Tailwind CSS - Styling
- Framer Motion - Animations
- React Hook Form - Form handling
- Zod - Schema validation
- Docker and Docker Compose
- Git
-
Clone the repository
git clone https://github.com/yourusername/user-onboarding-flow.git cd user-onboarding-flow -
Copy environment file
cp .env.example .env
-
Start the application
docker compose up --build
-
Access the application
- Frontend: http://localhost:3001
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/api/docs/
Note: Default ports are 3001 for frontend, 8000 for API, and 5433 for PostgreSQL. These can be changed in
docker-compose.ymlif needed.
-
Navigate to backend directory
cd backend -
Create virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Set environment variables
export DATABASE_URL=postgres://user:password@localhost:5432/onboarding export SECRET_KEY=your-secret-key export DEBUG=True
-
Run migrations
python manage.py migrate
-
Start the server
python manage.py runserver
-
Navigate to frontend directory
cd frontend -
Install dependencies
npm install
-
Set environment variables
export NEXT_PUBLIC_API_URL=http://localhost:8000 -
Start the development server
npm run dev
| Method | Endpoint | Description |
|---|---|---|
| GET | /onboarding/me |
Get current onboarding status |
| POST | /onboarding/step/{step} |
Save step data (profile, company, preferences) |
| POST | /onboarding/complete |
Mark onboarding as completed |
| POST | /onboarding/reset |
Reset onboarding and clear all data |
# Get onboarding status
curl -H "X-User-ID: user123" http://localhost:8000/onboarding/me
# Save profile step
curl -X POST http://localhost:8000/onboarding/step/profile \
-H "Content-Type: application/json" \
-H "X-User-ID: user123" \
-d '{
"data": {
"first_name": "John",
"last_name": "Doe",
"email": "john@example.com"
}
}'- user_id: string (unique)
- current_step: enum (profile, company, preferences, done)
- status: enum (in_progress, completed, abandoned)
- created_at: datetime
- updated_at: datetime
- user_id: string (unique)
- data: JSONB (step data stored as JSON)
- updated_at: datetime
The onboarding flow includes smart conditional logic:
-
Skip Preferences: If a company indicates they have existing tools (
has_existing_tools: true), the preferences step is skipped and the user goes directly to completion. -
Step Validation: Each step validates data before allowing progression.
-
Resume Capability: Users can close the browser and return later - their progress is automatically restored.
user-onboarding-flow/
├── backend/
│ ├── config/ # Django settings
│ ├── onboarding/ # Main app
│ │ ├── models.py # Data models
│ │ ├── serializers.py # API serializers
│ │ ├── views.py # API views
│ │ ├── urls.py # URL routing
│ │ └── tests.py # Unit tests
│ ├── Dockerfile
│ ├── manage.py
│ └── requirements.txt
├── frontend/
│ ├── src/
│ │ ├── app/ # Next.js app router
│ │ ├── components/ # React components
│ │ │ └── steps/ # Step components
│ │ ├── hooks/ # Custom hooks
│ │ └── lib/ # Utilities & API
│ ├── Dockerfile
│ └── package.json
├── docker-compose.yml
├── .env.example
└── README.md
cd backend
python manage.py testcd frontend
npm test| Variable | Description | Default |
|---|---|---|
POSTGRES_DB |
Database name | onboarding |
POSTGRES_USER |
Database user | postgres |
POSTGRES_PASSWORD |
Database password | postgres |
SECRET_KEY |
Django secret key | - |
DEBUG |
Debug mode | True |
ALLOWED_HOSTS |
Allowed hosts | localhost,127.0.0.1 |
CORS_ALLOWED_ORIGINS |
CORS origins | http://localhost:3000 |
NEXT_PUBLIC_API_URL |
Backend API URL | http://localhost:8000 |
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some 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.
Built with care for a great user experience