For the owner
Before you go live
Dream to Win runs on ordinary web hosting. The first host can be Vercel. Later you can move the same app to Azure without rewriting it. Card payments are Stripe. Entries are saved only after Stripe confirms the payment.
Run it on your computer
- Install Node.js 22 and PostgreSQL, or use the Docker Compose file in this project.
- Copy
.env.exampleto.env.localand setDATABASE_URLandSESSION_SECRET. - Add your Stripe test secret key and webhook secret.
- Run
npm installthennpm run dev. Open the address it prints (port 3847). - Log in with the demo staff account on the login page, then open Staff desk in the footer.
What you need for real payments
- A Stripe account for the business.
- The live secret key in
STRIPE_SECRET_KEY(it starts withsk_live_). Test keys start withsk_test_. - A webhook endpoint in Stripe pointing at
https://dreamtowin.uk/api/webhooks/stripe, listening forcheckout.session.completed,checkout.session.async_payment_succeeded, andcheckout.session.expired. - The webhook signing secret in
STRIPE_WEBHOOK_SECRET. Without it, people can pay and still receive no ticket. - Set
NEXT_PUBLIC_SITE_URLtohttps://dreamtowin.ukso Stripe sends people back to the right place.
Point dreamtowin.uk at Vercel
- Put the project on Vercel and add a hosted Postgres database. Paste its connection string into
DATABASE_URL. Use the pooler address if the host offers one. - In the Vercel project, open Settings → Domains and add
dreamtowin.ukandwww.dreamtowin.uk. - At the company that registered the domain, create the DNS records Vercel shows. They are usually an A record for the bare domain and a CNAME for www pointing at
cname.vercel-dns.com. Use the exact values on screen, because Vercel can change them. - Wait until Vercel says the domain is valid and the certificate is ready. Send www to the bare domain, or the other way around, and stick to one.
- Vercel’s disk does not keep uploaded prize photos. Set
STORAGE_DRIVER=s3and an S3-compatible bucket (Azure Blob can speak that protocol) before staff upload images. - Set
NEXT_PUBLIC_DEMO_BANNER=falseandSEED_DEMO=false. Remove sample tickets from the staff desk. Change the demo passwords.
Legal review
Do this before real money is taken. A solicitor should review the terms, the FAQ, the skill questions, and the free postal route, and you should publish a real postal address. A paid prize draw without a proper skill question and a genuine free entry route can be an unlicensed lottery.
Moving to Azure later
The app does not depend on Vercel-only features. Build the included Dockerfile and run it on Azure Container Apps or Azure App Service. Point DATABASE_URL at Azure Database for PostgreSQL and turn on SSL. Keep the same Stripe keys, webhook, and SESSION_SECRET. For uploads, use Azure Blob Storage through its S3-compatible endpoint and the storage settings in .env.example. When the container is healthy, change the DNS for dreamtowin.uk from Vercel to the Azure hostname.