HeckarNews icon indicating copy to clipboard operation
HeckarNews copied to clipboard

Idiot's guide for how to run on vercel?

Open x9099 opened this issue 2 years ago • 14 comments

I am dumb but I forked the repo and ran it in vercel and get errors. Can you post a screenshot of what I should put in vercel config? thanks!

x9099 avatar Feb 03 '22 01:02 x9099

waw, thanks for submitting an issue. glad someone actually interest in this.

you can checkout to deployment branch. there are some config that vercel needs there. the branch that we are going to deploy is this branch not the master branch.

you are not going to deploy all the repo from the root, instead you must deploy this one by one (or use monorepo if possible). so,

for website (the front-end):

  • during importing the project, select the root to be website

  • the environment variable to be set is only for algolia if you set up Algolia already, but that doesnt matter, you can leave it if you want. env variable

  • after you have deploy, set the production branch to deployment then you must redeploy the project (add commit then push or something for vercel so that vercel will redeploy it)

for the rest-api (the server, backend):

  • you can checkout to deployement branch first and change productionWebsiteUrl inside rest-api/config.js to match with your deployed website url previously

  • inside rest-api/index.js you must update the mongo string URI to match with yours. don't forget to push your changes.

  • then you can deploy this as previously, create new project, then set the root to rest-api.

  • for env var, this two is a must. so you must setup your mongodb first to be able to use this.

  • then you can set the production branch to deployment as what we did previously.

after both (front/back-end) has been deployed:

  • edit your PRODUCTION_API_URL inside website/next.config.js to match with your backend (api) url that has been deployed recently. Then push that commit to production branch so vercel will re deploy your project again

krehwell avatar Feb 03 '22 04:02 krehwell

surely there is big possibilities that you will find problem I guess, as life never run flawlessly :D. lmk.

krehwell avatar Feb 03 '22 04:02 krehwell

Oh cool, thanks so much for replying! I spent like 4 hours searching through HN clones and yours was the only one that was actually a clone -- all the others were missing core bits. Thanks so much for putting it up. Going through this tonight.

x9099 avatar Feb 03 '22 04:02 x9099

sure. glad I can be useful for other after 20+ years of having a life. haha

krehwell avatar Feb 03 '22 04:02 krehwell

Also please put an eth account on your page if you are happy to do so, when I am rich I can come back round and pay you something, eta 6 months

x9099 avatar Feb 03 '22 04:02 x9099

haha, surely. when I've eth wallet then I'll put that (I don't have any crypto currently :( ). just don't forget to come back when you are rich then i'll setup mine B).

krehwell avatar Feb 03 '22 04:02 krehwell

try metamask.io !

x9099 avatar Feb 03 '22 04:02 x9099

@xu9099 I forgot to let you know that I think authentication won't work if you host your front-end and the api on vercel domain since the cross origin will not work. image

that's just the limitation by the guy who make internet though. I see currently you able to deploy the front-end but still using my api for the requested data (you still request to forum-api.krehwell.com). that leads to the authentication never work so far for your deployment.

cross origin will work on the same owned domain only.

krehwell avatar Feb 04 '22 02:02 krehwell

Also please put an eth account on your page if you are happy to do so, when I am rich I can come back round and pay you something, eta 6 months

I want to do that too, Monero, PayPal can be.

s3689 avatar Jul 04 '22 01:07 s3689

I want to do that too, Monero, PayPal can be.

@s3689 @x9099 my PayPal should be: PayPal.Me/krehwell

krehwell avatar Jul 04 '22 04:07 krehwell

I want to do that too, Monero, PayPal can be.

@s3689 @x9099 my PayPal should be: PayPal.Me/krehwell

ok, i took note

s3689 avatar Jul 04 '22 07:07 s3689

I want to do that too, Monero, PayPal can be.

@s3689 @x9099 my PayPal should be: PayPal.Me/krehwell

treat you to a cup of coffee ☕️, have you received PayPal?

s3689 avatar Jul 05 '22 05:07 s3689

treat you to a cup of coffee ☕️, have you received PayPal?

hey yup, great, thank you stranger of the internet!

krehwell avatar Jul 05 '22 06:07 krehwell

treat you to a cup of coffee ☕️, have you received PayPal?

hey yup, great, thank you stranger of the internet!

it's nothing

s3689 avatar Jul 05 '22 07:07 s3689