-
Initialized an empty TypeScript project in the
backend
folder by running the following command:npm init -y
to creat a
package.json
-
Then To configure TypeScript for the project, I installed TypeScript as a development dependency:
npm install typescript --save-dev
-
Created a tsconfig.json file to define the compiler options:
npx tsc --init
-
In tsconfig.json specified "outDir": "./dist" & "rootDir": "./src".
-
index.ts needs express, so installed
npm install express @types/express
-
Intialized AWS EC2 instance, S3 scalable cloud storage (bucket setup) and cloudfront CDN
-
Initialized (next app) user & worker frontends
прх create-next-app
-
Designed schema using postgres(DB) & prisma(ORM) by installing
npm i prisma
under bsckend and then initialisednpx prisma init
to set up Prisma ORM(by writing tables) and then migrated to postgresnpx prisma migrate dev
-
Added endpoints for User and Worker routes and for sso installing JWT
npm i jsonwebtoken
laternpm i --save-dev @types/jsonwebtoken
to prevent type error -
to compile code
tsc -b
& to runnode dist/index.js
and tested through postman.
- through
npm i @aws-sdk/client-s3
as well asnpm i @aws-sdk/s3-presigned-post
and this endpoint making through authmiddleware to identify user - make sure of created IAM user to be assigned to one of the security groups that are related to buckets and also make sure to not include token in headers.
- Added
npm i zod
after making changes in index.ts to parse data that user send to bakcend through body [basically to validate input send by user]. - re migrated schema as removed option_id from options
npx prisma migrate dev --name emove_option_id
and regenerate client throughnpx prisma generate
. - tested task end point(post) with json on postman { options: [ { imgUrl: 'asd' }, { imgUrl: 'Fandom_image_url' }, { imgUrl: 'random_image_url' } ], signature: '0x123123123' }
- tested task(get) endpoint http://localhost:3000/v1/user/task?taskId=1
- creting endpoints to worker and removed bal_id from worker schema and migrated
npx prisma migrate dev --name remove_balid_worker
then generatednpx prisma generate
undr be. - Again modified Task schema by altering it with done col, so migrate and generate.
- once again
npx prisma migrate dev --name added_unique_constraint
and regenerate.
- added cors package
npm i cors @types/cors
to enable communication between backend (BE) and FE as they both hosted on different ports - under user fe created appbar, hero, upload and uploadImage files and tested AWS s3 connection to fetch images through cloudfront url with status 200ok.
- created dynamic routes folder
cd app && mkdir -p task/\[taskId\]
to contain page.tsxtouch "task/[taskId]/page.tsx"
that returns specific options submitted userId == taskId - developed worker fe and user fe to track task submissions and psots resepectively.
-
Installing
npm install --save \ @solana/wallet-adapter-base \ @solana/wallet-adapter-react \ @solana/wallet-adapter-react-ui \ @solana/wallet-adapter-wallets \ @solana/web3.js
under user fe and thennpm i tweetnacl
&npm i @solana/web3.js
in user be to make connections, and get tx signtr & blockhashes. -
did as same as above in worker fe and be as well
-
wrapped entire code base with wallet provider as a context with layout.ts in root level