Repository navigation
Architecture
This page describes the high-level architecture of CrowdWide and how its main components interact.
| Technology | Purpose |
|---|---|
| Node.js | JavaScript runtime |
| Express.js | HTTP server and routing |
| EJS | Server-rendered HTML templates |
| MongoDB | Persistent data storage |
A typical request follows this flow:
- A user opens a page or submits a form.
- Express receives the HTTP request.
- Middleware handles applicable tasks such as sessions, authentication, and request processing.
- A route or controller performs the required application logic.
- The application accesses MongoDB when data needs to be read or updated.
- EJS renders a response when a server-rendered page is required.
- Express sends the response to the user's browser.
The exact flow depends on the route and feature being used.
Routes define the application's HTTP endpoints and determine how incoming requests are handled.
Middleware can process requests before they reach route handlers. Examples include session handling, authentication checks, and error handling.
MongoDB stores application data. The database models and collections define how individual types of data are represented.
EJS templates generate HTML pages on the server using application data.
Authentication identifies users, while session management can preserve login state across requests.
- Keep secrets and credentials in environment variables.
- Validate user input on the server.
- Apply authentication and authorization checks where required.
- Handle errors without exposing sensitive internal details.
- Protect session cookies and sensitive routes.
To understand the actual implementation, explore the repository's source files and identify:
- The application entry point.
- Express route definitions.
- Middleware configuration.
- Database models and connection setup.
- EJS templates and static assets.
- Authentication and session configuration.
Use the source code as the authoritative reference for implementation details.