Convert your handwritten notes into an interactive study guide
https://perceptron.gopubby.com
Tip
The following commands are designed for a Linux environment. You may need to adjust them for your operating system.
-
Clone the repository
git clone https://github.com/bossbadi/perceptron
-
Install the dependencies
npm install
-
Create a Supabase project
- Complete steps 1-3 in the restoration instructions
-
Add environment variables
cp .env.example .env # and fill in .env with your environment variables
-
Run the application in development mode
npm run dev
or in production mode
npm run build npm run preview
Vercel is the obvious choice here, but keep in mind that Vercel functions have a 10 second timeout limit. If the images you upload are too large, the question generation will be stuck on the loading screen.
Therefore, I recommend hosting the app on a private server. I'm currently using Fly.io and everything works great.
To automatically redeploy the app on Fly.io every time you push changes, add the following action secrets to your repository:
ENV_FILE
= Copy and paste the contents of.env
FLY_API_TOKEN
= Create a Fly.io access token and add it here
-
Install PostgreSQL
sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - sudo apt update sudo apt install -y postgresql-15
-
Set environment variables
export PGPASSWORD="YOUR_DATABASE_PASSWORD" export CONNECTION_STRING="YOUR_DATABASE_CONNECTION_STRING"
-
Backup the schema (structure of the database)
pg_dumpall -f backups/schema.sql -d $CONNECTION_STRING --schema-only --no-owner --clean
-
Backup the data (contents of the database)
pg_dumpall -f backups/data.sql -d $CONNECTION_STRING --data-only --disable-triggers
You can restore to a hosted Supabase project or a local one.
-
Install PostgreSQL
sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - sudo apt update sudo apt install -y postgresql-15
-
Set environment variables
export PGPASSWORD="YOUR_DATABASE_PASSWORD" export CONNECTION_STRING="YOUR_DATABASE_CONNECTION_STRING"
-
Restore the schema
psql -d $CONNECTION_STRING -f backups/schema.sql
-
Restore the data
psql -d $CONNECTION_STRING -f backups/data.sql
-
If you're restoring to a hosted Supabase project, you may need to manually update some configurations, such as enabling auth providers.
-
Install Docker
sudo apt install -y docker.io
-
Start Supabase
npm exec supabase start
-
Stop Supabase
npm exec supabase stop
-
Reset Supabase to a clean state
npm exec supabase db reset