Backend server written in NodeJS for testiny-web. checkout tech-stack
for quick overview of technologies used.
Clone this repo.
$ npm i -g yarn # install yarn
$ # make sure you have set up postgres, and have DATABASE_URL in .env
$ yarn all # checkout package.json to know what it does
heroku-cli
heroku login
inside the project directory, and login.Set following required environment variables (How To).
Environment Variable Name | Value |
---|---|
ENV |
production |
JWT_SECRET |
something_unguessable_secret_key_here |
PROD_DATABASE_URL |
database_url_from_previous_step |
Name | Description |
---|---|
express |
server |
prisma |
to hopefully make DBMS easier. |
postgres |
Database. |
bcrypt , jsonwebtoken , uuid |
Hashing passwords, generating tokens and unique IDs respectively among other usages. |
typescript |
Maintainability. |
https://likegeeks.com/linux-mail-server/#Linux_SMTP_server - want to try custom mail server for sending various mails - can't because my ISP doesn't provide me a static IP for free, and it takes a while to update DNS records every time I point my domain to the dynamic IP. Reverse DNS, and https'ing is needed otherwise Gmail doesn't even accept the mail (not even in the spam folder). I don't have a credit card, nor money, so can't buy a cheap vps either, so this is postponed until I find a solution. (UPDATE: This is not possible even with AWS EC2 because GMail has blacklisted all the ip-addresses. I managed to run a SMTP server, but Gmail automatically rejects the mails (not even in spam :/) So, I'll have to rely on some SaaS service that provides this functionality, potentially AWS SnS.)
https://wiki.archlinux.org/index.php/PostgreSQL - Guide for setting up postgresql locally. After you set it up successfully, edit the .env
file and provide the database URL. Alternatively, you can use Heroku.
https://gist.github.com/soheilhy/8b94347ff8336d971ad0 -> For setting proxies, when we want to run backend and frontend on single VPS.