Thank you for your interest in contributing to StellarAid! This guide will help you get started with local development, coding standards, and the contribution workflow.
- Local Setup
- Environment Variables
- Project Structure
- Branch Naming
- Coding Standards
- Component Conventions
- Pull Request Guidelines
- Good First Issues
- Node.js 18+ (推荐 20 LTS)
- npm 9+ or yarn 1.22+
- Git
- Freighter Browser Extension (for wallet features)
-
Fork the repository on GitHub.
-
Clone your fork:
git clone https://github.com/<your-username>/stellarAid-web.git cd stellarAid-web
-
Add upstream remote:
git remote add upstream https://github.com/Dfunder/stellarAid-web.git
-
Install dependencies:
npm install
-
Copy the environment file:
cp .env.example .env.local
-
Start the development server:
npm run dev
-
Open in browser: Navigate to http://localhost:3000
| Command | Description |
|---|---|
npm run dev |
Start development server |
npm run build |
Production build |
npm run lint |
Run ESLint |
npm run type-check |
Run TypeScript type checking |
npm run test |
Run unit tests with Vitest |
npm run test:watch |
Run tests in watch mode |
npm run format |
Format code with Prettier |
npm run cypress:open |
Open Cypress E2E tests |
Copy .env.example to .env.local and configure:
# API Configuration
NEXT_PUBLIC_API_URL=http://localhost:3001
# Socket.io
NEXT_PUBLIC_SOCKET_URL=http://localhost:3001
# Cloudinary (for image uploads)
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME=your_cloud_name
# Stellar Network
NEXT_PUBLIC_STELLAR_NETWORK=testnet
# Authentication
NEXTAUTH_SECRET=your_secret_here
NEXTAUTH_URL=http://localhost:3000Important: Never commit
.env.localor any file containing secrets. The.gitignoreis configured to exclude these files.
stellarAid-web/
├── app/ # Next.js App Router pages
│ ├── admin/ # Admin dashboard pages
│ ├── artists/ # Artist discovery pages
│ ├── auth/ # Authentication pages
│ ├── commissions/ # Commission management
│ ├── dashboard/ # User dashboards (artist, client)
│ ├── explore/ # Project exploration
│ ├── marketplace/ # Marketplace services
│ ├── portfolio/ # Portfolio views
│ ├── settings/ # User settings
│ ├── features/ # Redux slices & thunks
│ ├── providers/ # Context providers
│ └── components/ # Page-level components
├── components/ # Shared UI components
│ ├── analytics/ # Charts and analytics
│ ├── commissions/ # Commission-related components
│ ├── common/ # Generic reusable components
│ ├── landing/ # Landing page sections
│ └── wallet/ # Wallet connection & balance
├── constants/ # App-wide constants
├── hooks/ # Custom React hooks
├── lib/ # Utilities and API helpers
│ ├── api/ # API function wrappers
│ ├── stellar/ # Stellar/Soroban utilities
│ └── utils/ # General utilities
├── stores/ # Zustand stores
├── types/ # TypeScript type definitions
└── utils/ # Additional utilities
Use descriptive branch names with the following prefixes:
| Prefix | Usage | Example |
|---|---|---|
feat/ |
New features | feat/dark-mode-toggle |
fix/ |
Bug fixes | fix/wallet-balance-refresh |
chore/ |
Maintenance tasks | chore/update-dependencies |
docs/ |
Documentation | docs/api-reference |
refactor/ |
Code refactoring | refactor/commission-hooks |
- Use TypeScript for all new files
- Avoid
anytype; use proper types orunknownwith type guards - Define interfaces for component props
- Use discriminated unions for complex state
- Use functional components with hooks
- Mark client components with
'use client'directive when needed - Use Next.js App Router conventions
- Prefer Server Components when no interactivity is needed
- Use Tailwind CSS utility classes
- Follow the existing design system colors (
primary,secondary,accent,neutral) - Support dark mode with
dark:variants - Maintain responsive design with mobile-first approach
- Use Redux Toolkit for global state (auth, services, commissions)
- Use React Query for server state and caching
- Use Zustand for simple client-only state
- Prefer hooks over direct store access
- Use toast notifications for user-facing errors (
utils/toast.ts) - Log errors to console in development
- Provide meaningful error messages
- Components:
PascalCase.tsx(e.g.,WalletBalance.tsx) - Hooks:
camelCase.tswithuseprefix (e.g.,useWalletBalance.ts) - Utilities:
camelCase.ts - Types:
camelCase.tsor grouped intypes/directory
'use client';
import { useState } from 'react';
import { SomeIcon } from 'lucide-react';
interface MyComponentProps {
title: string;
onSelect: (id: string) => void;
}
export default function MyComponent({ title, onSelect }: MyComponentProps) {
// State
// Effects
// Handlers
// Render
return <div className="...">{/* Content */}</div>;
}- Write tests for new components and utilities
- Use Vitest + React Testing Library
- Test user interactions and edge cases
- Keep test files adjacent to source files with
.test.tsxsuffix
-
Sync with upstream:
git fetch upstream git rebase upstream/main
-
Run checks:
npm run lint npm run type-check npm run test -
Format your code:
npm run format
- Branch is created from
upstream/main - Code follows the project's coding standards
- New components have proper TypeScript types
- Dark mode support is included (
dark:variants) - Responsive design is considered
- No console errors or warnings
- Tests pass
- PR description explains the changes clearly
- Related issues are linked (e.g.,
Closes #123)
## Summary
Brief description of changes.
## Changes
- Change 1
- Change 2
## Testing
How to test these changes.
Closes #issue_numberLooking for ways to contribute? Check out these beginner-friendly issues:
Feel free to open a discussion or reach out on the project's communication channels. We're happy to help!
Thank you for contributing to StellarAid!