- Implement both frontend and serverless backend for reserving booking ticket
- Managing discounts and train searching
- Auto calculate ticket start booking date
- Update train discounts and special days everyday with cron-job
- Booking Ticket at every exactly 00:00:00 and retry until 2 AM
web
: Full-stack app for reserving ticket and searching trains with discountsfunctions
: Serverless backend for crawling and booking tickets with
crawler
: crawling discounts and special days from thsr websitedatabase
: database modelstaiwan-id
: taiwanese id validator and generatortdx-api
: tdx apiticket-flow
: booking thsr ticket floweslint-config-custom
:eslint
configurations (includeseslint-config-next
andeslint-config-prettier
)tsconfig
:tsconfig.json
s used throughout the monorepo
Each package/app is 100% TypeScript.
To build all apps and packages, run the following command:
pnpm run build
To develop frontend, run the following command:
pnpm run dev
- Handled deploy firebase functions
- Firebase not support monorepo
- Prisma needed to set
binaryTargets
for running on Firebase functions
- Handled booking ticket flow with cookies validation
- Handled cleaning crawled data
- Handled retry mechanism
- Handled locale timezone (firebase cloud functions is run at utc+0 and frontend is utc+8)
- Tried many free databases, finally choose PostgreSQL with Supabase due to:
- Firebase firestore: it's not type safe enough and it is annoying to handle
TimeStamp
in firestore and convert it toDate
- MySQL with PlanetScale: Planet doesn't support foreign keys
- PostgreSQL with fly.io: it is a mistake..., it is not supported outside applications to connect
- Firebase firestore: it's not type safe enough and it is annoying to handle