-
-
Notifications
You must be signed in to change notification settings - Fork 0
Project Structure
This page explains the folder structure and architecture used in SecureAuth.
Understanding the project structure helps developers navigate the codebase more efficiently.
SecureAuth is built using:
- React + TypeScript frontend
- Express.js backend
- Vite build system
- Firebase integration
- Secure authentication architecture
SecureAuth
├── public/
├── src/
├── server.ts
├── package.json
├── vite.config.ts
├── tsconfig.json
├── .env
├── README.md
└── metadata.jsonContains static assets used by the application.
Example:
public/
├── banner.jpg
├── preview.gif
├── favicon.ico
├── apple-touch-icon.png
└── icons/Used for:
- Images
- Icons
- PWA assets
- Static resources
Main frontend application source code.
Example structure:
src/
├── components/
├── pages/
├── hooks/
├── services/
├── utils/
├── types/
├── contexts/
└── main.tsxReusable UI components.
Examples:
components/
├── Button.tsx
├── Modal.tsx
├── Navbar.tsx
└── SessionCard.tsxUsed for reusable UI logic and layouts.
Application pages and route-level views.
Examples:
pages/
├── Login.tsx
├── Dashboard.tsx
├── Settings.tsx
└── Sessions.tsxCustom React hooks.
Examples:
hooks/
├── useAuth.ts
├── useTheme.ts
└── useSession.tsHandles API communication and external integrations.
Examples:
services/
├── auth.ts
├── api.ts
├── firebase.ts
└── textsnap.tsUtility/helper functions.
Examples:
utils/
├── encryption.ts
├── validation.ts
└── formatters.tsGlobal application state management.
Examples:
contexts/
├── AuthContext.tsx
├── ThemeContext.tsx
└── SessionContext.tsxTypeScript type definitions.
Examples:
types/
├── auth.ts
├── session.ts
└── account.tsMain backend server entry point.
Responsibilities:
- API routes
- Authentication handling
- Session validation
- OTP verification
- Database communication
Vite configuration file.
Used for:
- Build configuration
- PWA setup
- Allowed hosts
- Development server settings
Project metadata and dependency configuration.
Contains:
- Scripts
- Dependencies
- Build commands
Environment variables and secrets.
Contains:
- JWT secrets
- Encryption keys
- Firebase credentials
- API tokens
Frontend (React)
↓
API Requests
↓
Express Backend
↓
Authentication Validation
↓
Firebase Storage
↓
Encrypted Data HandlingImportant security-related areas:
utils/encryption.ts
services/auth.ts
server.ts
.envPWA support files:
public/icons/
vite.config.ts
manifest configuration
service worker filesDeployment-related files:
package.json
server.ts
vite.config.ts
Dockerfile
ecosystem.config.cjs- Keep components reusable
- Separate API logic into services
- Store utilities in utils/
- Use TypeScript types consistently
- Keep secrets inside
.env
Avoid committing:
.env- API keys
- Firebase secrets
- JWT secrets
Avoid large monolithic components.
Continue with:
Secure • Fast • Modern ⚡
SecureAuth
Secure • Fast • Modern ⚡