A mobile application for Vastu Shastra analysis built with React Native, TypeScript, Express, Prisma, and PostgreSQL. Features complete user authentication with email/password and Google OAuth, persistent login state, and a custom drawer navigation menu.
# Install backend dependencies
cd backend
npm install
# Install mobile app dependencies
cd ..
npm install
# Setup environment variables
cp backend/.env.example backend/.env
# Update DATABASE_URL and Google OAuth credentials in backend/.env
# Start backend
cd backend
npm run dev
# In a new terminal, start mobile app
npm run android # or npm run ios- Email/Password Authentication - Secure signup and login with validation
- Google OAuth Integration - Configured with OAuth 2.0 credentials (in progress)
- JWT Token Management - Secure token-based session handling
- Password Security - bcrypt hashing with salt rounds (10)
- Token Storage - AsyncStorage for persistent sessions across app restarts
- Persistent Login - User data and token automatically restored on app launch
- LoginScreen - Email/password authentication with validation, API integration, links to SignUp
- SignUpScreen - User registration with email, password, name fields, real-time validation
- WelcomeScreen - Onboarding page with feature grid, menu button (β°), and smooth animations
- CustomDrawer - Side menu with user profile (avatar, name, email), menu items (Home, Dashboard, Profile, Learn Vastu, Settings), and logout button
- DashboardScreen - Protected screen template for post-authentication content
- ProfileFormScreen - User profile management form template
- RESTful API - Complete authentication endpoints (signup, login, profile management)
- PostgreSQL Database - Prisma ORM with type safety, automatically migrated
- Google OAuth - Passport.js integration configured and ready for testing
- JWT Authentication - Secure token-based auth with JWT signing and verification
- Input Validation - express-validator middleware for email, password, and name fields
- Error Handling - Comprehensive error responses with proper HTTP status codes
- Database Models - User (with email, password, name, googleId, profile fields) and VastuAnalysis tables
CustomButton- Primary, secondary, and outline variants with loading/disabled statesCustomTextInput- Labeled input with validation, password toggle, and error displayCustomCard- Glass morphism and solid card variants with icon supportCustomDrawer- Custom Modal-based drawer with animated slide transitions and user profile display
- Colors - Centralized color palette with primary (#db7706)
- Typography - Font families, sizes, weights, and line heights
- Spacing - Consistent spacing scale and border radius system
- AuthService - API call management
- StorageService - Token and user data persistence
- Google Auth Util - OAuth flow handling
- API Config - Centralized endpoint configuration
Vastu-Analyzer-mad/
βββ backend/ # Backend API Server
β βββ prisma/
β β βββ schema.prisma # Database schema
β βββ src/
β β βββ config/ # Database & OAuth config
β β βββ middleware/ # Auth & error middleware
β β βββ routes/ # API routes
β β βββ utils/ # JWT & password utilities
β β βββ index.ts # Server entry
β βββ .env.example # Environment template
β βββ package.json
β
βββ src/
β βββ screens/ # All screens
β β βββ LoginScreen.tsx # β
Email/password auth, API integrated
β β βββ SignUpScreen.tsx # β
User registration with validation
β β βββ WelcomeScreen.tsx # β
Onboarding with feature grid and menu button
β β βββ DashboardScreen.tsx # β
Protected dashboard template
β β βββ ProfileFormScreen.tsx # β
Profile management template
β βββ components/ # Reusable components
β β βββ CustomButton.tsx
β β βββ CustomTextInput.tsx
β β βββ CustomCard.tsx
β β βββ CustomDrawer.tsx # β
NEW - Modal-based side menu
β βββ services/ # β
API services and storage
β β βββ storage.service.ts # β
AsyncStorage for token/user data
β β βββ auth.service.ts
β βββ config/ # β
API configuration
β βββ utils/ # β
Helper functions
β βββ theme/ # Design system
β
βββ QUICK_START.md # π Start here!
βββ AUTHENTICATION_GUIDE.md # Auth implementation details
βββ MOBILE_SETUP.md # Mobile app setup
βββ backend/README.md # Backend setup guide
βββ setup.bat / setup.sh # Automated setup scripts
βββ package.json
- QUICK_START.md - Get up and running in 5 minutes
- AUTHENTICATION_GUIDE.md - Complete auth implementation
- backend/README.md - Backend setup and deployment
- MOBILE_SETUP.md - Mobile app configuration
- Sign Up: User creates account with email/password β validation β API call to
/api/auth/signupβ token received β stored in AsyncStorage - Login: User enters credentials β validation β API call to
/api/auth/loginβ JWT token received β user data stored β navigates to Welcome screen - Persistent Login: App checks AsyncStorage on launch β if token exists, user automatically logged in β skips authentication screens
- Token Storage: JWT token and user data (name, email) saved in AsyncStorage using
storage.service.ts - Drawer Menu: After successful login, hamburger menu (β°) displays on Welcome screen β opens custom drawer β shows user profile and menu items β logout clears AsyncStorage
- Session Management: Token sent with protected API requests, logout clears stored credentials
- React Native 0.83.1
- TypeScript
- AsyncStorage (token persistence)
- Expo Web Browser & Auth Session (OAuth)
- Node.js + Express
- Prisma ORM
- PostgreSQL
- Passport.js (Google OAuth)
- JWT (jsonwebtoken)
- bcryptjs (password hashing)
POST /api/auth/signup - Create account (email, password, name) POST /api/auth/login - Email/password login (returns JWT token) GET /api/auth/google - Initiate Google OAuth flow GET /api/auth/google/callback - OAuth callback handler GET /api/auth/verify - Verify JWT token validity (protected)
GET /api/user/profile - Get user profile data (protected) PUT /api/user/profile - Update profile info (protected)
POST /api/analysis/upload - Upload floor plan/image GET /api/analysis/list - Get user's analyses GET /api/analysis/:id - Get analysis detailsd) PUT /api/user/profile - Update profile (protected)
# Getting Started
> **Note**: Make sure you have completed the [Set Up Your Environment](https://reactnative.dev/docs/set-up-your-environment) guide before proceeding.
## Quick Setup
### 1. Install Dependencies
```bash
# Backend
cd backend
npm install
# Mobile App
cd ..
npm install
Use Supabase (free) or local PostgreSQL:
# Create backend/.env file
cp backend/.env.example backend/.env
# Update DATABASE_URL in backend/.env
DATABASE_URL="postgresql://user:password@localhost:5432/vastu_analyzer"cd backend
npm run prisma:generate
npm run prisma:migratecd backend
npm run dev
# Server running on http://localhost:3000# In a new terminal
npm run android # or npm run iosFirst, you will need to run Metro, the JavaScript build tool for React Native.
To start the Metro dev server, run the following command from the root of your React Native project:
# Using npm
npm start
# OR using Yarn
yarn startWith Metro running, open a new terminal window/pane from the root of your React Native project, and use one of the following commands to build and run your Android or iOS app:
# Using npm
npm run android
# OR using Yarn
yarn androidFor iOS, remember to install CocoaPods dependencies (this only needs to be run on first clone or after updating native deps).
The first time you create a new project, run the Ruby bundler to install CocoaPods itself:
bundle installThen, and every time you update your native dependencies, run:
bundle exec pod installFor more information, please visit CocoaPods Getting Started guide.
# Using npm
npm run ios
# OR using Yarn
yarn iosIf everything is set up correctly, you should see your new app running in the Android Emulator, iOS Simulator, or your connected device.
This is one way to run your app β you can also build it directly from Android Studio or Xcode.
Now that you have successfully run the app, let's make changes!
Open App.tsx in your text editor of choice and make some changes. When you save, your app will automatically update and reflect these changes βΒ this is powered by Fast Refresh.
When you want to forcefully reload, for example to reset the state of your app, you can perform a full reload:
- Android: Press the R key twice or select "Reload" from the Dev Menu, accessed via Ctrl + M (Windows/Linux) or Cmd β + M (macOS).
- iOS: Press R in iOS Simulator.
You've successfully run and modified your React Native App. π₯³
- If you want to add this new React Native code to an existing application, check out the Integration guide.
- If you're curious to learn more about React Native, check out the docs.
If you're having issues getting the above steps to work, see the Troubleshooting page.
To learn more about React Native, take a look at the following resources:
- React Native Website - learn more about React Native.
- Getting Started - an overview of React Native and how setup your environment.
- Learn the Basics - a guided tour of the React Native basics.
- Blog - read the latest official React Native Blog posts.
@facebook/react-native- the Open Source; GitHub repository for React Native.