### NPM Commands for Project Setup and Management Source: https://github.com/conorluddy/residents/blob/main/README.md This section provides a collection of `npm` scripts used for initializing the database schema, starting the development server, seeding the database with test data, and running project tests. These commands streamline common development and maintenance tasks for the `residents` project, leveraging `drizzle-kit` for database operations. ```npm npm run push ``` ```npm npm run dev ``` ```npm npm run seed ``` ```npm npm run test ``` ```npm npm run ``` -------------------------------- ### Create Environment Configuration File Source: https://github.com/conorluddy/residents/blob/main/README.md Copies the example environment file (`.env.example`) to create a new `.env` file. This file is crucial for storing sensitive configuration details such as database connection strings, API keys, and other environment-specific variables required by the application. ```shell cp .env.example .env ``` -------------------------------- ### Install Node.js Dependencies Source: https://github.com/conorluddy/residents/blob/main/README.md Installs all required Node.js packages and modules for the project as defined in the `package.json` file. This command should be run after cloning the repository to set up the development environment. ```shell npm install ``` -------------------------------- ### Create Environment Configuration File Source: https://github.com/conorluddy/residents/blob/main/docs/README.md Copies the example environment file to create a new `.env` file, which needs to be configured with specific database connection details and API keys for the project to run. ```bash cp .env.example .env ``` -------------------------------- ### Start Development Server Source: https://github.com/conorluddy/residents/blob/main/docs/README.md Starts the Node.js/Express application in development mode, typically with features like live reloading for efficient development. ```bash npm run dev ``` -------------------------------- ### Install Node.js Dependencies Source: https://github.com/conorluddy/residents/blob/main/docs/README.md Installs all required Node.js packages for the project. This is the first step after cloning the repository to set up the development environment. ```bash npm install ``` -------------------------------- ### API Endpoints Feature Matrix Source: https://github.com/conorluddy/residents/blob/main/README.md This matrix details the current status and feature coverage for various API endpoints within the `residents` project. It indicates whether an endpoint is built, has unit tests, integration tests, or Swagger documentation, providing a quick overview of API completeness and development progress. ```APIDOC Endpoint | Built | Unit Tests | Integration Tests | SwaggerDocs -------------------------------|-------|------------|-------------------|------------- `POST /auth/login` | ✅ | ✅ | ⛔️ | ⛔️ `POST /auth/logout` | ✅ | ✅ | ⛔️ | ⛔️ `POST /auth/magic-login` | ✅ | ✅ | ⛔️ | ⛔️ `POST /auth/magic-login-token`| ✅ | ✅ | ⛔️ | ⛔️ `POST /auth/reset-password` | ✅ | ✅ | ⛔️ | ⛔️ `POST /auth/refresh` | ✅ | ✅ | ⛔️ | ⛔️ `POST /auth/reset-password-token` | ✅ | ✅ | ⛔️ | ⛔️ `POST /auth/validate-account` | ✅ | ⚠️ | ⛔️ | ⛔️ `GET /auth/google` | ✅ | ✅ | ⛔️ | ⛔️ `GET /auth/google/callback` | ✅ | ✅ | ⛔️ | ⛔️ `GET /users` | ✅ | ✅ | ⛔️ | ⛔️ `GET /users/:id` | ✅ | ✅ | ⛔️ | ⛔️ `POST /users` | ✅ | ✅ | ⛔️ | ⛔️ `PUT /users/:id` | ✅ | ✅ | ⛔️ | ⛔️ `DELETE /users/:id` | ✅ | ✅ | ⛔️ | ⛔️ `GET /users/self` | ✅ | ✅ | ⛔️ | ⛔️ ``` -------------------------------- ### External Service Integration Requirements Source: https://github.com/conorluddy/residents/blob/main/docs/README.md Outlines requirements for integrating external services like Sendgrid for email and Google for social login. Notes the need for API keys and account setup for these services, with future plans for Apple and Microsoft integrations. ```APIDOC External Service Requirements: Email: Sendgrid (account setup, verified email) Social Login (Google): Google app, API key Future Plans: Apple, Microsoft social login Note: Facebook integration not planned. ``` -------------------------------- ### Integrate ESLint React plugin and rules Source: https://github.com/conorluddy/residents/blob/main/examples/react/README.md This JavaScript configuration snippet shows how to import and use the `eslint-plugin-react` within your `eslint.config.js`. It sets the React version in `settings`, adds the plugin, and enables its recommended rules for React and JSX runtime. ```js // eslint.config.js import react from 'eslint-plugin-react' export default tseslint.config({ // Set the react version settings: { react: { version: '18.3' } }, plugins: { // Add the react plugin react, }, rules: { // other rules... // Enable its recommended rules ...react.configs.recommended.rules, ...react.configs['jsx-runtime'].rules, }, }) ``` -------------------------------- ### GitHub Actions CI/CD Workflow Source: https://github.com/conorluddy/residents/blob/main/docs/README.md Details the continuous integration and deployment process implemented using GitHub Actions. It covers automated installation, testing, and building across multiple Node.js versions, along with code coverage reporting. ```APIDOC GitHub Actions CI/CD: Triggers: On each commit Actions: - Installs dependencies - Runs tests - Builds project Node.js Versions: 16, 18, 20, 22 Reporting: Code coverage report with CodeCov Deployment: Not currently deployed ``` -------------------------------- ### Configure ESLint parserOptions for type-aware linting Source: https://github.com/conorluddy/residents/blob/main/examples/react/README.md This JavaScript snippet demonstrates how to set up the `parserOptions` within the `languageOptions` of your `tseslint.config`. It specifies the TypeScript project files (`tsconfig.node.json`, `tsconfig.app.json`) and the root directory for type-aware linting rules. ```js export default tseslint.config({ languageOptions: { // other options... parserOptions: { project: ['./tsconfig.node.json', './tsconfig.app.json'], tsconfigRootDir: import.meta.dirname, }, }, }) ``` -------------------------------- ### Postman API Collection Overview Source: https://github.com/conorluddy/residents/blob/main/docs/README.md Describes the Postman collection available for the Residents API. It facilitates quick setup, automatic JWT management for authorization, and interaction with various endpoints. ```APIDOC Postman Collection: Location: postman directory Features: - Quick API setup - Automatic JWT saving and usage for authorization - Environment management ``` -------------------------------- ### Initialize PostgreSQL Database Schema Source: https://github.com/conorluddy/residents/blob/main/docs/README.md Runs the Drizzle ORM toolkit to set up the database schema in Postgres. This command requires a running PostgreSQL database configured in the `.env` file. ```bash npm run push ``` -------------------------------- ### List Available NPM Scripts Source: https://github.com/conorluddy/residents/blob/main/docs/README.md Displays a list of all available NPM scripts defined in the project's `package.json` file, providing a quick reference for common development tasks. ```bash npm run ``` -------------------------------- ### Seed Database with Test Data Source: https://github.com/conorluddy/residents/blob/main/docs/README.md Executes a script to populate the database with sample 'Residents' data, which is useful for testing purposes or interacting with the API via Postman. ```bash npm run seed ``` -------------------------------- ### PostgreSQL Database Requirements Source: https://github.com/conorluddy/residents/blob/main/docs/README.md Specifies the need for a PostgreSQL database for the Node/Express application. Provides options for running Postgres (local, Docker, cloud services) and emphasizes configuring connection details in the `.env` file. ```APIDOC Database Requirements: Type: PostgreSQL Connection: Required via `.env` file Deployment Options: Standalone app, Docker, Cloud (e.g., Neon.tech, Vercel) ``` -------------------------------- ### Code Test Coverage Approach Source: https://github.com/conorluddy/residents/blob/main/docs/README.md Outlines the project's testing philosophy, emphasizing high test coverage for integrity. It uses CodeCov for reporting and primarily focuses on unit tests, with plans for future integration and end-to-end tests. ```APIDOC Test Coverage: Goal: Extreme coverage for integrity Tool: CodeCov for reporting Current Focus: Mostly unit tests Future Plans: Fill out integration and end-to-end tests after API features are complete. ``` -------------------------------- ### Express.js Middleware Configuration Source: https://github.com/conorluddy/residents/blob/main/docs/README.md Describes the use of common Express.js middlewares like Helmet and RateLimiter for security and performance. Indicates a future review for additional useful middlewares to be added. ```APIDOC Express Middleware: Configured Middlewares: Helmet, RateLimiter Purpose: Security, performance Future: Revisit for additional useful middlewares. ``` -------------------------------- ### Run Project Tests Source: https://github.com/conorluddy/residents/blob/main/docs/README.md Executes the test suite for the project, including unit, integration, and end-to-end tests to ensure code integrity. ```bash npm run test ``` -------------------------------- ### TypeScript Type Coverage Strategy Source: https://github.com/conorluddy/residents/blob/main/docs/README.md Explains the project's commitment to strong TypeScript typing, utilizing the 'type-coverage' tool to monitor and enforce type usage. It runs as a pre-commit hook and displays coverage via a dynamic badge. ```APIDOC TypeScript Typing: Principle: Strongly typed, no `any` or `unknown` Tool: `type-coverage` by @plantain-00 Process: - Runs on pre-commit hook - Generates JSON report in `.github` - Displays coverage via dynamic Shields.io badge Current Status: Express `req` and `res` objects are currently untyped, aiming for near 100%. ``` -------------------------------- ### API Endpoint Feature Matrix Source: https://github.com/conorluddy/residents/blob/main/docs/README.md Lists the current status of various API endpoints related to authentication and user management, indicating whether they are built, have unit tests, integration tests, and Swagger documentation. ```APIDOC Endpoint: POST /auth/login Built: ✅ Unit Tests: ✅ Integration Tests: ⛔️ SwaggerDocs: ⛔️ Endpoint: POST /auth/logout Built: ✅ Unit Tests: ⛔️ Integration Tests: ⛔️ SwaggerDocs: ⛔️ Endpoint: POST /auth/magic-login Built: ⛔️ Unit Tests: ⛔️ Integration Tests: ⛔️ SwaggerDocs: ⛔️ Endpoint: POST /auth/magic-login-token Built: ⛔️ Unit Tests: ⛔️ Integration Tests: ⛔️ SwaggerDocs: ⛔️ Endpoint: POST /auth/reset-password Built: ✅ Unit Tests: ✅ Integration Tests: ⛔️ SwaggerDocs: ⛔️ Endpoint: POST /auth/refresh Built: ✅ Unit Tests: ✅ Integration Tests: ⛔️ SwaggerDocs: ⛔️ Endpoint: POST /auth/reset-password-token Built: ✅ Unit Tests: ✅ Integration Tests: ⛔️ SwaggerDocs: ⛔️ Endpoint: POST /auth/validate-account Built: ✅ Unit Tests: ⚠️ Integration Tests: ⛔️ SwaggerDocs: ⛔️ Endpoint: GET /auth/google Built: ✅ Unit Tests: ✅ Integration Tests: ⛔️ SwaggerDocs: ⛔️ Endpoint: GET /auth/google/callback Built: ✅ Unit Tests: ✅ Integration Tests: ⛔️ SwaggerDocs: ⛔️ Endpoint: GET /users Built: ✅ Unit Tests: ✅ Integration Tests: ⛔️ SwaggerDocs: ⛔️ Endpoint: GET /users/:id Built: ✅ Unit Tests: ✅ Integration Tests: ⛔️ SwaggerDocs: ⛔️ Endpoint: POST /users Built: ✅ Unit Tests: ✅ Integration Tests: ⛔️ SwaggerDocs: ⛔️ Endpoint: PUT /users/:id Built: ✅ Unit Tests: ✅ Integration Tests: ⛔️ SwaggerDocs: ⛔️ Endpoint: DELETE /users/:id Built: ✅ Unit Tests: ✅ Integration Tests: ⛔️ SwaggerDocs: ⛔️ Endpoint: GET /users/self Built: ✅ Unit Tests: ✅ Integration Tests: ⛔️ SwaggerDocs: ⛔️ ``` -------------------------------- ### CSS Styling for Login Form Elements Source: https://github.com/conorluddy/residents/blob/main/examples/vanilla/index.html This CSS snippet defines the visual appearance and layout for a web-based login form. It includes styles for the overall page body to center content, the form container with padding and shadow, input fields for consistent sizing, submit buttons with a distinct look, and a message display area for user feedback. ```CSS body { font-family: Arial, sans-serif; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background-color: #f0f0f0; } form { background-color: white; padding: 20px; border-radius: 5px; box-shadow: 0 0 10px rgba(0,0,0,0.1); } input { display: block; margin: 10px 0; padding: 5px; width: 200px; } button { background-color: #007bff; color: white; border: none; padding: 10px 15px; border-radius: 3px; cursor: pointer; } #message { margin-top: 20px; font-weight: bold; } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.