Generates a story, audio, and quiz based off a set of preferences and a list of vocabulary. Quiz timing and accuracy is recorded for later.
Snow Day defaults to using Inngest for background tasks, Supabase for a database, and Vercel for hosting. It is pretty easy to replace Supabase with another Postgresql host, but Inngest and Vercel are pretty tightly coupled with the code.
All Vercel deployments are done through integration with the code host. You will want to connect Vercel to the code repository, and then Vercel can handle the deployment from there.
Most of the code right now, and all of the code eventually, will live in the nextjs-app folder as part of the next.js app. There are still a couple python scripts for generating and testing stories, audio and quizzes that live in the src or generators folders.
Inngest has a handy CLI for starting the local function runner. You will start this up as a separate process from the next.js app.
The next.js app can be started in developer mode with npm run dev.
Python scripts were developed with Python 3.13.6. All python scripts will soon be deprecated.
This project contains a GCP Cloud Function for generating stories based on a given storyline.
- Node.js (v20 or higher)
- Google Cloud SDK
- Prisma CLI
The following environment variables are required to run the GCP function. These should be set in your local environment and in the GitHub repository's secrets for automated deployment.
GCP_SA_KEY: A JSON key for a Google Cloud service account with permissions to deploy Cloud Functions and access other required services. To get this key:- Go to the GCP Console.
- Navigate to IAM & Admin > Service Accounts.
- Click Create Service Account.
- Give the service account a name and description.
- Grant the service account the Cloud Functions Admin and Service Account User roles.
- Click Done.
- Click on the newly created service account.
- Go to the Keys tab.
- Click Add Key > Create new key.
- Select JSON as the key type and click Create.
- The JSON key file will be downloaded. The content of this file is the value for
GCP_SA_KEY.
OPENAI_API_KEY: Your API key for OpenAI.GEMINI_API_KEY: Your API key for Google Gemini. To get this key:- Go to Google AI Studio.
- Sign in with your Google account.
- Click on "Get API key" in the left sidebar.
- Click "Create API key" and select a Google Cloud project (or create a new one).
- Copy the generated API key - this is the value for
GEMINI_API_KEY. - Note: The Gemini API has usage limits and pricing. Check the pricing page for current rates.
DATABASE_URL: The connection string for your PostgreSQL database. This should be in the formatpostgresql://USER:PASSWORD@HOST:PORT/DATABASE.
The application uses a Google Cloud Storage bucket to store the generated audio files. The deploy.sh script will automatically create a bucket named story-audio-PROJECT_ID (where PROJECT_ID is your GCP project ID) and set the appropriate permissions.
If you need to create the bucket manually, follow these steps:
- Create the Bucket:
gsutil mb -p YOUR_PROJECT_ID -l US-CENTRAL1 gs://story-audio-YOUR_PROJECT_ID
- Set Public Access:
gsutil iam ch allUsers:objectViewer gs://story-audio-YOUR_PROJECT_ID
- Set Environment Variable:
When deploying the function, you'll need to set the
GCP_BUCKET_NAMEenvironment variable to the name of your bucket. Thedeploy.shscript handles this automatically.
-
Install Dependencies:
cd functions npm install -
Run the Function Locally:
npm start
The function is automatically deployed to GCP when changes are pushed to the main branch. To deploy manually, run the following command from the functions directory:
./deploy.sh