A modern Nostr client application built with React 18.x, TailwindCSS 3.x, Vite, shadcn/ui, and Nostrify.
- 🚀 Built with React 18 and TypeScript for type-safe development
- 💨 Fast development with Vite
- 🎨 Styled with TailwindCSS 3.x and shadcn/ui components
- 🔐 Nostr protocol integration with Nostrify
- 📱 Responsive design
- 🔄 Real-time data with TanStack Query
- 🎯 Client-side routing with React Router
- 🔌 Extensible architecture with custom hooks
Before you begin, ensure you have the following installed:
git clone <your-repository-url>
cd marketplacenpm installnpm run devThe application will be available at http://localhost:5173 (or the port shown in your terminal).
# Start development server
npm run dev# Run all tests (TypeScript check, ESLint, Vitest, and build)
npm test# Build for production
npm run buildThis command will:
- Install dependencies
- Build the application
- Create a 404.html file for client-side routing support
# Deploy to Surge.sh (quick deployment)
npm run deployThis will build the application and deploy it to Surge.sh.
The project includes a built-in deploy script for Surge.sh:
npm run deployFollow the prompts to choose a domain name or use the suggested one.
-
Install Vercel CLI:
npm install -g vercel
-
Deploy:
vercel
-
Follow the prompts to configure your deployment.
-
Build the project:
npm run build
-
Deploy using Netlify CLI:
npm install -g netlify-cli netlify deploy --dir=dist
-
For production deployment:
netlify deploy --dir=dist --prod
-
Install gh-pages:
npm install --save-dev gh-pages
-
Add to package.json scripts:
"predeploy": "npm run build", "gh-deploy": "gh-pages -d dist"
-
Deploy:
npm run gh-deploy
-
Build the project:
npm run build
-
The
distfolder contains all static files ready to be served by any web server (Nginx, Apache, etc.). -
Example Nginx configuration:
server { listen 80; server_name your-domain.com; root /path/to/your/dist; index index.html; location / { try_files $uri $uri/ /index.html; } }
If you need to configure environment variables:
- Create a
.envfile in the root directory - Add your environment variables prefixed with
VITE_:VITE_APP_NAME=My Nostr App VITE_PUBLIC_RELAY_URL=wss://relay.example.com
- Access them in your code:
const appName = import.meta.env.VITE_APP_NAME;
marketplace/
├── public/ # Static assets
├── src/
│ ├── components/ # React components
│ │ ├── ui/ # shadcn/ui components
│ │ └── ... # Custom components
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Utility functions
│ ├── pages/ # Page components
│ └── App.tsx # Main app component
├── index.html # Entry HTML file
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── vite.config.ts # Vite configuration
└── README.md # This file
The application includes custom hooks for Nostr protocol integration:
useNostr()- Access Nostr query and event publishing methodsuseAuthor()- Fetch user profile metadatauseNostrPublish()- Publish events to the Nostr networkuseCurrentUser()- Get current logged-in user informationuseUploadFile()- Upload files with NIP-94 compatibility
Use the built-in LoginArea component for Nostr authentication:
import { LoginArea } from "@/components/auth/LoginArea";
function MyComponent() {
return <LoginArea />;
}The project uses shadcn/ui components. Available components include:
- Accordion, Alert, Avatar, Badge, Button, Card, Dialog, and many more
- All components are customizable with Tailwind CSS
- Path Aliases: Use
@/prefix for imports (e.g.,@/components/ui/button) - Type Safety: The project uses TypeScript - ensure all code is properly typed
- Testing: Always run
npm testbefore committing changes - Component Library: Check
/src/components/uifor available UI components - Nostr Events: Use the custom hooks for all Nostr interactions
-
Port already in use: If port 5173 is busy, Vite will use a different port. Check the terminal output.
-
Build errors: Run
npm testto identify TypeScript or linting issues. -
Nostr connection issues: Ensure you're connected to the internet and the relays are accessible.
- Check the Nostr protocol documentation
- Review Nostrify documentation
- Consult shadcn/ui documentation
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is open source and available under the MIT License.
- Built with MKStack template
- Powered by Nostrify for Nostr protocol support
- UI components from shadcn/ui
- Styled with TailwindCSS