LC_GH.mp4
(TLDR: Personal preference) Redux has a lot of boilerplate for a personal project. Zustand is lightweight, easy to get started with.
NOTE FOR NEW DEVS: ALWAYS RUN ARBITRARY CODE IN A SANDBOX ENVIRONMENT,NOT ON YOUR REAL MACHINE.
For a sandbox environment, we could either send our code to some VM running Python (or even a docker container) Since the code execution time is quite small for running the code (Max timeout is ~5 seconds for the code) we can use serverless to cut down on hardware costs.
NOTE 2: Do not use serverless functions for long running functions
(Not a paid post) They were the simplest to get started with, and free (no credit card required). Vercel functions could be used too, but I was needed a Python runtime.
Alternatives include AWS Lambda and Cloudflare Worker (they have generous free tiers but will require a card), and Open Source alternatives are OpenFaas or Nuclio (the setup was proving to be a hassle).
- Add Clerk Authentication (halfway done with the PR) for tracking user progress.
- Adding Submissions table for tracking submissions.
- Checking for stats like time and memory of the code.
- Maybe a GUI for adding new problems
- Clone the repository.
- Start the postgres db instance using
docker compose up -d
- Head to the directory
/coding-platform
, install dependencies withnpm install
- Run the migrations with
npx prisma db push
and fill the database with the commandnpm run seed-db
. - Add the following variables to your
.env
DATABASE_URL="postgresql://user:password@localhost:5432/db?schema=public"
APPWRITE_FUNCTION_ENDPOINT=<GET FROM APPWRITE FUNCTIONS CONSOLE>
- Run it with
npm run dev
- Create an application on Appwrite, and create a Function. Set the location of the function to
./coding-platform/appwrite/main.py
- On your console, use the following commands to work with the serverless function locally (install appwrite cli with
npm i appwrite-cli@latest
npx appwrite init
and then link to existing project. The function would be pulled from Appwrite console.npx appwrite run functions --port 8000
to start the local server. You can useAPPWRITE_FUNCTION_ENDPOINT=http://localhost:8000
in the env while running this.