Photoshot
An open-source AI avatar generator web app
demo-final.mp4
Try it out at photoshot.app
Stack
- β² Next.js for webapp
πΌ Chakra UI for UI componentsπ¦ Prisma for databaseπ§ Replicate, a platform for running machine learning models in the cloudπ° Stripe for paymentsπ©βπ¨ Stable Diffusion an open-source text-to-image generation model
Getting Started
Install dependencies:
yarn install
You can use Docker to run a local postgres database and maildev server (accessible at http://localhost:1080):
docker-compose up -d
Create .env.local:
cp .env.example .env.local
Update environment variable values:
// Database connection string of your database (postgresql here)
DATABASE_URL=postgresql://photoshot:photoshot@localhost:5432/photoshot
// https://next-auth.js.org/configuration/options#nextauth_url
NEXTAUTH_URL=http://localhost:3000
// AWS S3 bucket info (for storing pictures)
S3_UPLOAD_KEY=
S3_UPLOAD_SECRET=
S3_UPLOAD_BUCKET=
S3_UPLOAD_REGION=
// Replicate API token / username
REPLICATE_API_TOKEN=
REPLICATE_USERNAME=
REPLICATE_MAX_TRAIN_STEPS=3000
REPLICATE_NEGATIVE_PROMPT=
REPLICATE_HD_VERSION_MODEL_ID=
// Replicate instance token (should be rare)
NEXT_PUBLIC_REPLICATE_INSTANCE_TOKEN=
// Random secret for NextAuth
SECRET=
// SMTP server and email address to send emails from
EMAIL_FROM=
EMAIL_SERVER=smtp://localhost:25
// Stripe API key
STRIPE_SECRET_KEY=
// Price of a studio in cents (ie: 1000 = $10)
NEXT_PUBLIC_STRIPE_STUDIO_PRICE=
// Amount of allowed shots per studio
NEXT_PUBLIC_STUDIO_SHOT_AMOUNT=
// Prompt wizard
OPENAI_API_KEY=
OPENAI_API_SEED_PROMPT=
Please note that if you want to use the provided docker-compose
setup you have to disable TLS
in your .env.local
by adding:
NODE_TLS_REJECT_UNAUTHORIZED = "0"
Run migrations
yarn prisma:migrate:dev
Run the development server:
npm run dev
# or
yarn dev
Open http://localhost:3000 with your browser to see the result.