This is a Next.js project bootstrapped with create-next-app
.
First, run the development server:
npm run dev
Open http://localhost:3000 with your browser to see the result.
Database is hosted on Supabase.
Updates are done via Prisma. Edit the schema in prisma/schema.prisma
and run the following commands to apply the changes.
- Make changes to the schema in
prisma/schema.prisma
- Run
npx prisma db push
- Run
npx prisma generate
- Restart dev server
Resets the database and seeds it with data for Cim
and Comarca
tables.
Caution
This will delete all data in the database!
npx prisma db seed
Note
Because Strava allows only one authorization callback domain per app and one app per account, we have a separate strava accounts (and app) for development and production.
- Strava Dashboard
- Webhook Events API documentation.
- Environement variables (e.g.
source .env
)STRAVA_CLIENT_ID=... STRAVA_CLIENT_SECRET=... STRAVA_VERIFY_TOKEN=...
- jq to parse json
- ngrok to test locally (optional) - Instrucions here
curl -sS -G https://www.strava.com/api/v3/push_subscriptions \
-d client_id=${STRAVA_CLIENT_ID} \
-d client_secret=${STRAVA_CLIENT_SECRET} | jq '.[] | .id'
local
curl -sS http://127.0.0.1:4040/api/tunnels \
| jq -r '.tunnels[0].public_url' \
| xargs -I {} \
curl -X POST https://www.strava.com/api/v3/push_subscriptions \
-F client_id=${STRAVA_CLIENT_ID} \
-F client_secret=${STRAVA_CLIENT_SECRET} \
-F verify_token=${STRAVA_VERIFY_TOKEN} \
-F callback_url={}/api/strava/webhook
production
curl -X POST https://www.strava.com/api/v3/push_subscriptions \
-F client_id=${STRAVA_CLIENT_ID} \
-F client_secret=${STRAVA_CLIENT_SECRET} \
-F verify_token=${STRAVA_VERIFY_TOKEN} \
-F callback_url=https://100cims.vercel.app/api/strava/webhook
curl -sS -G https://www.strava.com/api/v3/push_subscriptions \
-d client_id=${STRAVA_CLIENT_ID} \
-d client_secret=${STRAVA_CLIENT_SECRET} \
| jq '.[] | .id' \
| xargs -I {} \
curl -X DELETE \
"https://www.strava.com/api/v3/push_subscriptions/{}?client_id=${STRAVA_CLIENT_ID}&client_secret=${STRAVA_CLIENT_SECRET}"
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.