An autism screening application for Ghana with Firebase integration.
- Node.js v12 or higher (compatible with v12.22.12)
- npm or yarn
- Firebase account with Firestore database
/src- Frontend React components and application code/public- Static assets/backend- Express.js backend API server/dist- Production build (created when runningnpm run build)
The application uses Firebase Firestore with the following collections:
-
users: Stores user account information
uid: Firebase Auth user IDname: User's full nameemail: User's email addressrole: User role (e.g., "parent")emailVerified: Boolean flag for verification statusprofilePicture: URL to profile picturecreatedAt: Timestamp
-
childProfiles: Stores child profiles linked to parent users
parentUid: Reference to parent's Firebase Auth IDname: Child's namebirthDate: Child's date of birth (YYYY-MM-DD)gender: Child's gender (optional)photoUrl: URL to child's photo (optional)createdAt: Timestamp
-
screenings: Stores assessment results
profileId: Reference to child profile IDanswers: Object containing question responsesscore: Calculated score from assessmentriskLevel: Calculated risk levelrecommendations: Array of recommended actionscreatedAt: TimestampuserId: Reference to parent's Firebase Auth ID
# In the project root directory
npm install# Navigate to the backend directory
cd backend
npm install- Create a Firebase project at https://console.firebase.google.com/
- Enable Authentication with Email/Password
- Create a Firestore database
- Download your Firebase Admin SDK service account key
- Save it as
firebase-credentials.jsonin the/backenddirectory - Create a
.envfile in the/backenddirectory with:FIREBASE_API_KEY=your-api-key JWT_SECRET=your-jwt-secret
We've created a convenient script that starts both the backend and frontend servers:
# From the project root
chmod +x start.sh # Make the script executable (first time only)
./start.shThis script will:
- Kill any processes running on ports 3000 and 5002
- Start the backend server on port 5002
- Start the frontend development server on port 3000
# Make sure you're in the backend directory
cd backend
PORT=5002 node src/server.js# In a new terminal, from the project root
npm startnpm run buildIf you see errors like Error: listen EADDRINUSE: address already in use, kill the processes using those ports:
# Find processes using port 5002 (backend)
lsof -i :5002
# Kill the process
kill -9 <PID>
# For frontend (port 3000)
lsof -i :3000
kill -9 <PID>If you see an error about requiring an index, follow the link in the error message to create the necessary composite index in your Firebase console. This is typically needed for queries that:
- Filter on
profileId - Order by
createdAt
Always start the backend server from within the /backend directory:
cd /path/to/smiles_for_speech/backend
PORT=5002 node src/server.jsIf you encounter syntax errors with optional chaining (?.) or nullish coalescing (??), make sure you're using a compatible version of all packages.
- Firebase Authentication with email verification
- User profiles stored in Firestore
- Password reset functionality
- User authentication middleware
- Autism screening assessment form
- Child profile management
- Screening history and results visualization