First, install dependencies:
npm run patch-installOnce you've installed dependencies, start a development server:
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --openBefore creating a production version of your app, install an adapter for your target environment. Then:
npm run buildYou can preview the built app with
npm run preview, regardless of whether you installed an adapter. This should not be used to serve your app in production.
Before use will start developing, you should connect the following dependencies:
- MongoDB Realm App (https://www.mongodb.com/docs/atlas/app-services/manage-apps/deploy/automated/deploy-automatically-with-github/#std-label-deploy-github) the app configuration is placed inside this repository (/realm-app)
- Posthog Instance (https://posthog.com/docs/cloud)
- Vercel integration (https://vercel.com/docs/concepts/projects/overview)
- Vercel ENV variables
VITE_POSTHOG_COOKIE_NAME="posthog_userId"
VITE_POSTHOG_HOST="https://app.posthog.com"
VITE_POSTHOG_EVENT_NAME="SHORTLINK_CLICKED"
VITE_POSTHOG_TOKEN="" // (https://posthog.com/docs/api)
VITE_APP_DOMAIN=""
VITE_APP_HOST=""
VITE_API_URL="https://realm.mongodb.com/api/client/v2.0"
VITE_REALM_APP_NAME=""
VITE_REALM_APP_ID=""
VITE_REALM_API_KEY="" // this is the server API key for the Realm App (https://www.mongodb.com/docs/atlas/app-services/authentication/api-key/)
VITE_REFRESH_TOKEN_COOKIE_NAME="dev_refreshToken" // this is the name of the cookie that will be used to store the refresh token (e.g. for preview branches you can use "stage_refreshToken", for production "refreshToken")
VITE_ACCESS_TOKEN_COOKIE_NAME="dev_accessToken" // this is the name of the cookie that will be used to store the refresh token (e.g. for preview branches you can use "stage_accessToken", for production "accessToken")- Connect this app to Vercel via (npx vercel)
- Import environment variables for Vercel (npm run pre-dev)