Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idiot's guide for how to run on vercel? #1

Open
x9099 opened this issue Feb 3, 2022 · 14 comments
Open

Idiot's guide for how to run on vercel? #1

x9099 opened this issue Feb 3, 2022 · 14 comments

Comments

@x9099
Copy link

x9099 commented Feb 3, 2022

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!

@krehwell
Copy link
Owner

krehwell commented Feb 3, 2022

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
Copy link
Owner

krehwell commented Feb 3, 2022

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

@x9099
Copy link
Author

x9099 commented Feb 3, 2022

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.

@krehwell
Copy link
Owner

krehwell commented Feb 3, 2022

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

@x9099
Copy link
Author

x9099 commented Feb 3, 2022

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

@krehwell
Copy link
Owner

krehwell commented Feb 3, 2022

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).

@x9099
Copy link
Author

x9099 commented Feb 3, 2022

try metamask.io !

@krehwell
Copy link
Owner

krehwell commented Feb 4, 2022

@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.

@s3689
Copy link

s3689 commented Jul 4, 2022

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.

@krehwell
Copy link
Owner

krehwell commented Jul 4, 2022

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

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

@s3689
Copy link

s3689 commented Jul 4, 2022

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

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

ok, i took note

@s3689
Copy link

s3689 commented Jul 5, 2022

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?

@krehwell
Copy link
Owner

krehwell commented Jul 5, 2022

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

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

@s3689
Copy link

s3689 commented Jul 5, 2022

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

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

it's nothing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants