A flexible, open-source appointment scheduling system built with Flask.
# Clone the repository
git clone https://github.com/luisadrianpuga/schedule.git
# Navigate to project directory
cd schedule
# Activate virtual environment
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Set up the database
python3 sqlite_setup.py
# Run the application
python3 app.pyThe API will be available at http://localhost:8080
- π± User Management: Registration, authentication, and role-based permissions
- β° Availability Management: Professionals can define their available time slots
- π Appointment Booking: Students/parents can book appointments with professionals
- π£ Notifications: Email notifications for appointment status changes
- π¬ Communication: Messaging between professionals and students
- β Rating System: Review completed appointments
- π‘οΈ Role-Based Access: Different capabilities for professionals, students/parents, and admins
- Python 3.6+
- SQLite (embedded, no separate installation required)
- Virtual environment with dependencies (included in repo)
Note: The repository includes a virtual environment (
venv) with all required dependencies.
Configuration is done through environment variables:
| Variable | Description | Default |
|---|---|---|
PORT |
Server port | 8080 |
FLASK_ENV |
Environment (development/production) | development |
DB_FILE |
Database file path | appointment_system.db |
Example:
PORT=9000 FLASK_ENV=production python app.pyThe API is organized around RESTful principles with the following main endpoints:
| Endpoint | Method | Description |
|---|---|---|
/api/auth/register |
POST | Register a new user |
/api/auth/login |
POST | Login and get auth token |
/api/auth/logout |
POST | Logout (revoke token) |
/api/auth/verify-email |
POST | Verify user email |
| Endpoint | Method | Description |
|---|---|---|
/api/users/me |
GET | Get current user profile |
/api/users/me |
PATCH | Update current user profile |
When the database is created, the following test users are available:
| Type | Password | Description | |
|---|---|---|---|
| Admin | [email protected] | adminpassword | System administrator with full access |
| Professional | [email protected] | password | Service provider with availability |
| Student/Parent | [email protected] | password | User who can book appointments |
| Endpoint | Method | Description |
|---|---|---|
/api/appointments |
GET | Get user appointments |
/api/appointments |
POST | Create a new appointment |
/api/appointments/<id> |
GET | Get appointment details |
/api/appointments/<id>/status |
PUT | Update appointment status |
/api/appointments/<id>/rating |
POST | Rate an appointment |
| Endpoint | Method | Description |
|---|---|---|
/api/professionals |
GET | List all professionals |
/api/professionals/<id>/availability |
GET | Get professional's availability |
/api/professionals/<id>/availability |
POST | Create availability for professional |
| Endpoint | Method | Description |
|---|---|---|
/api/appointments/<id>/communications |
POST | Add communication to appointment |
| Endpoint | Method | Description |
|---|---|---|
/api/notifications |
GET | Get user notifications |
/api/notifications/<id>/read |
PUT | Mark notification as read |
schedule/
βββ app.py # Main application entry point
βββ sqlite_setup.py # Database schema and setup
βββ api_utilities.py # Shared utilities for the API
βββ requirements.txt # Python dependencies
Here are some common API calls you can make with curl:
curl -X POST http://localhost:8080/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "securepassword",
"name": "John Smith",
"role": "student_parent"
}'curl -X POST http://localhost:8080/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "securepassword"
}'Save the token from the response:
{
"success": true,
"data": {
"token": "your-auth-token-here",
"user": {...}
}
}curl -X GET http://localhost:8080/api/professionals/[professional_id]/availability \
-H "Authorization: Bearer your-auth-token-here"curl -X POST http://localhost:8080/api/appointments \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-auth-token-here" \
-d '{
"professional_id": "[professional_id]",
"slot_id": "[slot_id]",
"appointment_type_id": "[appointment_type_id]"
}'The system uses SQLite with the following main tables:
USERS: User accountsROLES: System roles (admin, professional, student_parent)AVAILABILITY: Professional availability blocksAPPOINTMENT_SLOTS: Individual bookable time slotsAPPOINTMENTS: Booked appointmentsCOMMUNICATION_LOGS: Messages between usersNOTIFICATIONS: System notifications
The database needs to be set up manually before running the application:
# Create and populate the database
python3 sqlite_setup.pyThis will create appointment_system.db with test data including:
- Admin user (email: [email protected], password: adminpassword)
- Test professional users with availability slots
- Test student/parent users
- Sample appointment types
If you want to reset the database:
# Delete the existing database
rm appointment_system.db
# Run the setup script again
python3 sqlite_setup.py- Define the route in
app.py - Implement authentication/authorization with
@auth_required() - Add necessary database operations in the route function
- Return standardized responses using
success_response()orerror_response()
Contributions are welcome! Please feel free to submit a Pull Request.
- 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.
- Flask - The web framework used
- SQLite - Embedded database
- Flask-CORS - CORS handling for the API