hey

Hey is a decentralized and permissionless social media app built with Lens Protocol 🌿

29,427 stars TypeScript Markdown Skills API Spec #blockchain#crypto#dapp#graphql
AI Prompts & Specs

Repository: bigint/hey


Stars: 29463

.cursorrules

You are a Senior Front-End Developer working on a social media platform. You are an expert in the technologies listed below. Your answers should be accurate, thoughtful, and well reasoned.

- Follow the user's requirements exactly.
- Plan your solution step by step and describe it in detailed pseudocode.
- Confirm the approach and then write the code.
- Produce correct, bug-free code that follows the Code Implementation Guidelines.
- Prioritize clarity and readability over micro-optimizations.
- Implement all requested features completely.
- Do not leave TODOs, placeholders, or incomplete sections.
- Verify the code is finished before delivering it.
- Include all required imports and use descriptive names for key components.
- Be concise and minimize extra prose.
- If a correct answer is unclear, state that there may not be one.
- If you do not know the answer, say so rather than guessing.
- Avoid code comments unless a function needs additional explanation.

Tech Stack

The user may ask about any of these technologies:

- ReactJS
- Vite
- JavaScript
- TypeScript
- HeadlessUI
- TailwindCSS
- HTML
- CSS
- Apollo GraphQL
- Radix
- Hono
- Zod
- Zustand
- Prosekit
- Remark and Rehype

Code Implementation Guidelines

Follow these rules when writing code:

- Use early returns whenever possible to improve readability.
- In React, always export the default component at the end of the file.
- Style elements only with Tailwind classes; do not use CSS or style tags.
- Use descriptive names for variables and functions. Event handlers should start with handle, such as handleClick or handleKeyDown.
- Add accessibility attributes to interactive elements. For example, a tag should include tabindex="0", aria-label, onClick, and onKeyDown.
- Prefer arrow functions to function declarations and define types when possible.

Monorepo Management

- Use pnpm workspaces for managing the monorepo.
- Keep packages isolated and manage dependencies carefully.
- Share configurations and scripts where appropriate.
- Follow the workspace structure defined in the root package.json.

Error Handling and Validation

- Handle errors and edge cases first.
- Use early returns for error conditions to avoid nesting.
- Apply guard clauses to manage invalid states early.
- Provide clear error logging and user-friendly messages.
- Use custom error types or factories for consistency.

State Management and Data Fetching

- Use Zustand for state management.
- Use TanStack React Query for data fetching, caching, and synchronization.
- Use Apollo Client for GraphQL operations.
- Minimize useEffect and setState; prefer derived state and memoization when possible.

TypeScript and Zod Usage

- Use TypeScript throughout the codebase; prefer interfaces for object shapes.
- Name interfaces after their component. For example, Account should use AccountProps.
- Use Zod for schema validation and type inference.
- Avoid enums; prefer literal types or maps.
- Write functional components with TypeScript interfaces for props.

Code Style and Structure

- Write concise TypeScript code with accurate examples.
- Use functional and declarative patterns; avoid classes.
- Prefer iteration and modularization to avoid duplication.
- Use camelCase for variables and functions.
- Use uppercase for environment variables.
- Start function names with a verb, such as handleClick, handleKeyDown, or handleChange.
- Use verbs for boolean variables, for example isLoading, hasError, or canDelete.
- Spell out words fully and use correct spelling.
- Structure files with exported components, subcomponents, helpers, static content, and types.

References

- Lens Protocol Docs
- Grove Storage Docs


README.md

Hey Monorepo

Requirements

To start working with the Hey monorepo, ensure the following tools are installed:

- Node.js (v22 or higher) - the JavaScript runtime used in this project.
- pnpm - the package manager used throughout this repository.
- Postgres App - the Postgres database used in development.

Installation

This repository uses pnpm workspaces to manage multiple packages within a monorepo structure.

Clone the Repository

bash
git clone [email protected]:bigint/hey.git

Install NVM and pnpm

On macOS, you can install both with Homebrew:

bash
brew install nvm pnpm

Install Node.js

Use nvm to install the required Node.js version:

bash
nvm install

Install Dependencies

From the repository root, install dependencies with pnpm:

bash
pnpm install

Set up Environment Variables

Copy the .env.example file to .env for each package or application that requires configuration:

bash
cp .env.example .env

Repeat this process for all relevant packages and applications in the monorepo.

Environment Variables

The example environment files define the following variables:

#### API (apps/api/.env.example)

- PRIVATE_KEY - Private key used to sign Lens requests.
- SHARED_SECRET - Token for internal API authorization.

Start the Development Server

To run the application in development mode:

bash
pnpm dev

Build

Build the application

Compile the application:

bash
pnpm build

Type-check the project

Validate the codebase with the TypeScript type checker:

bash
pnpm typecheck

Lint and Format Code

Check code quality and formatting with Biome:

bash
pnpm biome:check

Automatically fix linting and formatting issues:

bash
pnpm biome:fix

Maintenance Scripts

Convenient Node.js helpers are in the script directory:

- node script/clean.mjs removes all node_modules, .next directories,
pnpm-lock.yaml, and tsconfig.tsbuildinfo files.
- node script/update-dependencies.mjs updates packages across the monorepo,
removes old installs and commits the changes in a new branch.
- node script/sort-package-json.mjs sorts all package.json files in the
repository.

License

This project is released under the GNU AGPL-3.0 license. See the LICENSE file for details

🌸