Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ WORKDIR /app

# Copy package files
COPY pnpm-lock.yaml package.json pnpm-workspace.yaml turbo.json ./
COPY apps/admin/package.json ./apps/admin/
COPY apps/webapp/package.json ./apps/webapp/
COPY packages/attribution-script/package.json ./packages/attribution-script/
COPY packages/coredb/package.json ./packages/coredb/
COPY packages/eslint-config/package.json ./packages/eslint-config/
Expand All @@ -18,20 +18,20 @@ COPY packages/types/package.json ./packages/types/
COPY packages/typescript-config/package.json ./packages/typescript-config/
COPY packages/ui/package.json ./packages/ui/

# Install dependencies only for admin app and its dependencies
RUN pnpm install --frozen-lockfile --filter @refref/admin... --ignore-scripts
# Install dependencies only for webapp app and its dependencies
RUN pnpm install --frozen-lockfile --filter @refref/webapp... --ignore-scripts

# Copy source code (excluding www)
COPY apps/admin ./apps/admin
COPY apps/webapp ./apps/webapp
COPY packages ./packages

# Run postinstall scripts now that source files are available
RUN pnpm install --frozen-lockfile --filter @refref/admin...
RUN pnpm install --frozen-lockfile --filter @refref/webapp...

# Build the admin application (with placeholder env vars for build time)
# Build the webapp application (with placeholder env vars for build time)
ENV DATABASE_URL="postgresql://placeholder"
ENV BETTER_AUTH_SECRET="placeholder-secret-for-build"
RUN pnpm build --filter @refref/admin...
RUN pnpm build --filter @refref/webapp...

# Production stage
FROM node:24-alpine AS runner
Expand All @@ -43,7 +43,7 @@ WORKDIR /app

# Copy necessary files from builder
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/apps/admin ./apps/admin
COPY --from=builder /app/apps/webapp ./apps/webapp
COPY --from=builder /app/packages ./packages
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/pnpm-workspace.yaml ./pnpm-workspace.yaml
Expand All @@ -57,5 +57,5 @@ ENV NODE_ENV=production
EXPOSE 3000

# Start the application
WORKDIR /app/apps/admin
WORKDIR /app/apps/webapp
CMD ["pnpm", "start"]
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ cd refref
docker-compose up
```

That's it! 🎉 The admin portal will be available at http://localhost:3000
That's it! 🎉 The webapp portal will be available at http://localhost:3000

Docker Compose automatically handles:

- PostgreSQL database setup
- Database migrations
- Initial data seeding
- Admin portal configuration
- Webapp portal configuration

### Local Development Setup

Expand All @@ -81,22 +81,22 @@ If you prefer running RefRef locally without Docker:
pnpm install

# Set up environment variables
cp apps/admin/.env.example apps/admin/.env
cp apps/webapp/.env.example apps/webapp/.env

# Edit .env and add your database URL and auth secret
# Generate auth secret with: openssl rand -base64 32

# Push database schema
pnpm -F @refref/admin db:push
pnpm -F @refref/webapp db:push

# (Optional) Seed with template data
pnpm -F @refref/admin db:seed
pnpm -F @refref/webapp db:seed

# Start development server
pnpm dev
```

The admin portal will be available at http://localhost:3000
The webapp will be available at http://localhost:3000

### Environment Variables

Expand Down Expand Up @@ -130,10 +130,10 @@ pnpm format
pnpm check-types

# Database commands
pnpm -F @refref/admin db:push # Push schema changes
pnpm -F @refref/admin db:migrate # Run migrations
pnpm -F @refref/admin db:studio # Open Drizzle Studio GUI
pnpm -F @refref/admin db:seed # Seed with templates
pnpm -F @refref/coredb db:push # Push schema changes
pnpm -F @refref/coredb db:migrate # Run migrations
pnpm -F @refref/coredb db:studio # Open Drizzle Studio GUI
pnpm -F @refref/coredb db:seed # Seed with templates
```

## ✨ Features
Expand Down
2 changes: 1 addition & 1 deletion apps/admin/.env.example → apps/webapp/.env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RefRef Admin Portal Environment Variables
# RefRef Webapp Environment Variables
# ==========================================
# Copy this file to .env and fill in your values

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion apps/admin/package.json → apps/webapp/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@refref/admin",
"name": "@refref/webapp",
"version": "0.1.0",
"private": true,
"type": "module",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ import {
const rewardStepSchema = z.object({
referrerReward: z.object({
enabled: z.boolean(),
valueType: z.enum(["fixed", "percentage"]),
valueType: z.enum(["fixed", "percentage"] as const),
value: z.number().positive().optional(),
currency: z.enum(["USD", "EUR", "GBP"]).optional(),
currency: z.enum(["USD", "EUR", "GBP"] as const).optional(),
}),
refereeReward: z.object({
enabled: z.boolean(),
valueType: z.enum(["fixed", "percentage"]),
valueType: z.enum(["fixed", "percentage"] as const),
value: z.number().positive().optional(),
currency: z.enum(["USD", "EUR", "GBP"]).optional(),
currency: z.enum(["USD", "EUR", "GBP"] as const).optional(),
minPurchaseAmount: z.number().positive().optional(),
validityDays: z.number().int().positive().optional(),
}),
Expand All @@ -57,6 +57,7 @@ export const RewardStep = forwardRef<
RewardStepProps
>(({ programId }, ref) => {
const form = useForm<RewardStepData>({
// @ts-expect-error - Zod v4 type compatibility issue with @hookform/resolvers
resolver: zodResolver(rewardStepSchema),
defaultValues: {
referrerReward: {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ services:
timeout: 5s
retries: 5

admin:
webapp:
build:
context: .
dockerfile: Dockerfile
container_name: refref-admin
container_name: refref-webapp
ports:
- "3000:3000"
environment:
Expand All @@ -37,13 +37,13 @@ services:
postgres:
condition: service_healthy
volumes:
- ./apps/admin/.env:/app/apps/admin/.env
- ./apps/webapp/.env:/app/apps/webapp/.env
command: >
sh -c "
cd /app &&
pnpm -F @refref/coredb db:push &&
pnpm -F @refref/coredb db:seed &&
cd /app/apps/admin &&
cd /app/apps/webapp &&
pnpm start
"

Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.