To install dependencies:
bun installTo start a development server:
bun devTo run for production:
bun startThis project was created using bun init in bun v1.2.4. Bun is a fast all-in-one JavaScript runtime.
-
Install dependencies with
bun install -
Copy
.env.exampleto.envand configure your environment variables:APP_RELAY_URL: Your relay URLAPP_PRIVATE_KEY: Your private key for initialization
-
Set up a development relay (required for local development)
-
We recommend using nak for development:
# Install nak go install github.com/fiatjaf/nak@latest # Start a local relay nak serve
-
The relay will be available at
ws://localhost:10547 -
Update your
.envfile with this relay URL
-
-
Initialize the application with default settings:
bun run startup
This will create:
- Default app settings
- User roles configuration
- Ban list
- Relay list
When you first start the application:
- If no settings are found in the configured relay, you'll be automatically redirected to
/setup - The first user to complete the setup process becomes the administrator
- Skip this step if you've run the startup script, as it creates default admin users
- Complete the setup form to configure your marketplace settings
- Skip this if you've run the startup script and want to use the default configuration
-
Start the development server:
bun dev:seed
start without seeding for a fresh start with no setup data
bun dev
-
In a separate terminal, run the route watcher:
bun run watch-routes
-
Optional: Seed the relay with test data:
bun seed
This project uses TanStack React Query (v5) for data fetching, caching, and state management. React Query helps with:
- Fetching, caching, and updating server state in your React applications
- Automatic refetching when data becomes stale
- Loading and error states handling
- Pagination and infinite scrolling
In our implementation, query functions and options are defined in the src/queries directory, using a pattern that separates query key factories and query functions.
Example:
// Query key factory pattern for organized cache management
export const postKeys = {
all: ['posts'] as const,
details: (id: string) => [...postKeys.all, id] as const,
}
// Query options for use in routes and components
export const postsQueryOptions = queryOptions({
queryKey: postKeys.all,
queryFn: fetchPosts,
})This project uses TanStack Router for file-based routing with built-in prefetching capabilities:
- File-based routing: Routes are defined in the
src/routesdirectory - Dynamic routes: Parameters in file names (e.g.,
posts.$postId.tsx) - Automatic route tree generation
Data prefetching is implemented via loader functions in route files:
export const Route = createFileRoute('/posts/')({
loader: ({ context: { queryClient } }) => queryClient.ensureQueryData(postsQueryOptions),
component: PostsRoute,
})The router is configured to prefetch data on "intent" (hovering over links) with zero stale time to ensure fresh data:
const router = createRouter({
routeTree,
context: {
queryClient,
nostr: nostrService,
},
defaultPreload: 'intent',
defaultPreloadStaleTime: 0,
})Set the .env variables by copying and renaming the .env.example file, then set your own values for the variables.
During development, you should spin up a relay to seed data and use it during the development cycle, you can use nak serve as a quick solution, or run another relay locally, then set it in your .env variables, and run bun seed to seed it.
During development, you should run the watch-routes command in a separate terminal:
bun run watch-routesThis command uses the TanStack Router CLI (tsr watch) to monitor your route files and automatically generate the route tree file (src/routeTree.gen.ts). This file connects all your route components into a coherent navigation structure.
Without running this command, changes to route files or creating new routes won't be detected until you manually generate the route tree or restart the server.
Staging deploys automatically after the E2E Tests workflow succeeds on master.
Production deploys require the production environment approval and can be triggered
either by pushing a *-release tag or by running the Promote to Production
workflow, which creates the next release tag for you.
git tag v0.2.9-release && git push origin v0.2.9-release- Ensure all changes are merged to
master - Wait for staging deployment to finish successfully
- Either:
Create and push a new tag with incremented version:
git tag vX.Y.Z-release && git push origin vX.Y.Z-release - Or run
Promote to Productionin GitHub Actions and choosepatch,minor, ormajor - The
Deploy to Productionworkflow will build and deploy the selected tag after approval