Browse Source

add more context for the ecosystem, with some specific cursor rules files

master
Trent Larson 4 weeks ago
parent
commit
830b63b424
  1. 56
      .cursor/rules/README.mdc
  2. 86
      .cursor/rules/node-express.mdc
  3. 57
      .cursor/rules/typescript.mdc
  4. 4
      README.md

56
.cursor/rules/README.mdc

@ -0,0 +1,56 @@
---
description:
globs:
alwaysApply: false
---
# Time Safari / Endorser Search Tech Ecosystem
### Purpose
This describes the overall design & architecture across code repositories.
The Endorser Server is a service that allows recording of cryptographically signed assertions in a privacy-preserving fashion. Each participant chooses whether to allow any other participant to see their name attached to activity. The service is a convenient way to get basic functions; we expect to provide direct P2P communications to support the same functionality for anyone who wants the alternative.
Time Safari is a front-end to make it intuitive and interesting to log self-asserted items, mainly of three kinds:
- Gives, recognizing something given
- Projects, which can then be the giver or recipient of gives
- Offers of help, to individuals or projects, which can be fulfilled by subsequent gives
### Structure
The primary repos contain the majority of the functionality; the secondary repos are helpful but not absolutely necessary.
These repos are found on the local filesystem in the same directory as this repo, in ../../../ from this file.
Primary Repos:
- endorser-ch is the back-end, written in Typescript
- crowd-funder-for-time-pwa is the front-end, written in Typescript with Vue & Vite, with deployments for mobile as well as web
Secondary Repos:
- image-api is a service for storing images, in Typescript
- py-push-server is a service to send push notifications
- lives-of-gifts is the website for the overall vision for humanity
- gifting-org-content is for design and other creative artifacts
- kickstarter-for-time is a playground to implement HTML designs that are subsequently moved into crowd-funder-for-time-pwa
- uport-demo is the web-facing front-end to explain the Endorser server
- endorser-docs is the documentation explaining the Endoser server design, in Restructured Text format
- time-safari-web is for the single pages at timesafari.org & timesafari.com
- endorser-mobile is the previous native app to talk to the Endorser server -- very powerful but harder to use
These repos are located in GitHub: endorser-ch, endorser-mobile, lives-of-gifts uport-demo, endorser-docs, time-safari-web
The remaining repos are located at gitea.anomalistdesign.com

86
.cursor/rules/node-express.mdc

@ -0,0 +1,86 @@
---
description: Node.js and Express.js best practices for backend development
globs: **/*.js, **/*.ts, src/**/*.ts
---
# Node.js and Express.js Best Practices
## Project Structure
- Use proper directory structure
- Implement proper module organization
- Use proper middleware organization
- Keep routes organized by domain
- Implement proper error handling
- Use proper configuration management
## Express Setup
- Use proper middleware setup
- Implement proper routing
- Use proper error handling
- Configure proper security middleware
- Implement proper validation
- Use proper static file serving
## API Design
- Use proper REST principles
- Implement proper versioning
- Use proper request validation
- Handle errors properly
- Implement proper response formats
- Document APIs properly
## Database Integration
- Use proper ORM/ODM
- Implement proper migrations
- Use proper connection pooling
- Implement proper transactions
- Use proper query optimization
- Handle database errors properly
## Authentication
- Implement proper JWT handling
- Use proper password hashing
- Implement proper session management
- Use proper OAuth integration
- Implement proper role-based access
- Handle auth errors properly
## Security
- Use proper CORS setup
- Implement proper rate limiting
- Use proper security headers
- Implement proper input validation
- Use proper encryption
- Handle security vulnerabilities
## Performance
- Use proper caching
- Implement proper async operations
- Use proper connection pooling
- Implement proper logging
- Use proper monitoring
- Handle high traffic properly
## Testing
- Write proper unit tests
- Implement proper integration tests
- Use proper test runners
- Implement proper mocking
- Test error scenarios
- Use proper test coverage
## Deployment
- Use proper Docker setup
- Implement proper CI/CD
- Use proper environment variables
- Configure proper logging
- Implement proper monitoring
- Handle deployment errors
## Best Practices
- Follow Node.js best practices
- Use proper async/await
- Implement proper error handling
- Use proper logging
- Handle process signals properly
- Document code properly

57
.cursor/rules/typescript.mdc

@ -0,0 +1,57 @@
---
description: TypeScript coding standards and best practices for modern web development
globs: **/*.ts, **/*.tsx, **/*.d.ts
---
# TypeScript Best Practices
## Type System
- Prefer interfaces over types for object definitions
- Use type for unions, intersections, and mapped types
- Avoid using `any`, prefer `unknown` for unknown types
- Use strict TypeScript configuration
- Leverage TypeScript's built-in utility types
- Use generics for reusable type patterns
## Naming Conventions
- Use PascalCase for type names and interfaces
- Use camelCase for variables and functions
- Use UPPER_CASE for constants
- Use descriptive names with auxiliary verbs (e.g., isLoading, hasError)
- Prefix interfaces for React props with 'Props' (e.g., ButtonProps)
## Code Organization
- Keep type definitions close to where they're used
- Export types and interfaces from dedicated type files when shared
- Use barrel exports (index.ts) for organizing exports
- Place shared types in a `types` directory
- Co-locate component props with their components
## Functions
- Use explicit return types for public functions
- Use arrow functions for callbacks and methods
- Implement proper error handling with custom error types
- Use function overloads for complex type scenarios
- Prefer async/await over Promises
## Best Practices
- Enable strict mode in tsconfig.json
- Use readonly for immutable properties
- Leverage discriminated unions for type safety
- Use type guards for runtime type checking
- Implement proper null checking
- Avoid type assertions unless necessary
## Error Handling
- Create custom error types for domain-specific errors
- Use Result types for operations that can fail
- Implement proper error boundaries
- Use try-catch blocks with typed catch clauses
- Handle Promise rejections properly
## Patterns
- Use the Builder pattern for complex object creation
- Implement the Repository pattern for data access
- Use the Factory pattern for object creation
- Leverage dependency injection
- Use the Module pattern for encapsulation

4
README.md

@ -1,3 +1,5 @@
# README-first
Context for all the repos
Context for all the technical info, mostly found in git repos
See ./.cursor/rules/README.mdc

Loading…
Cancel
Save