What is this? This is a simple project for Nimo Industries, to showcase SST Ion (https://ion.sst.dev/docs) and developing a simple API service.
The third-party API service is CoinGecko API, to search for cryptocurrency details.
To demonstrate why infrastructure-as-code frameworks are powerful & fast for DX.
And to highlight that you can do so much more with the SST Ion framework at the beginning, such as:
- Add new AWS RDS Postgres instance, for your long-term (and permanent) datasource.
- Add AWS SES for core mailing features, when ready to convert project to live environment.
- Integrate Express / Fastify frameworks within SST Ion, to scale your API microservices.
- Add API mock testing (such as
vitest
), with general unit testing for ALL your workspaces in the SST Ion project. - Enforce your environment variable management, with AWS Secrets Manager or using SST Ion's
Secret
feature.
The project design options are limitless.
To reduce significant costs, I am using the following AWS resources & third-party services.
- Supabase
postgres
- CoinGecko API (demo account only)
- MailTrap (for email sending/receiving tests)
- API Gateway
- S3
- drizzle-orm
- node-mailer
- uuid
- node-fetch
- postgres
First, you would need to configure your AWS CLI profile (assumed you have already set up a new AWS IAM user with access_key):
aws configure
Next, let's setup the project - pre-requisite to run curl -fsSL https://ion.sst.dev/install | bash
first (see https://ion.sst.dev/).
pnpm i
pnpm sst version
For database migration, run the following commands below:
npx drizzle-kit generate
Then:
npx drizzle-kit migrate
npx drizzle-kit push
Using SST's secret command feature, set up your environment variables below:
sst secret set ApiKey COINGECKO_API_KEY
sst secret set Drizzle POSTGRES_DB_CONNECTION_STRING
sst secret set MailSmtpHost SMTP_MAIL_HOST
sst secret set MailSmtpPort SMTP_MAIL_PORT
sst secret set MailUsername SMTP_MAIL_USERNAME
sst secret set MailPassword SMTP_MAIL_PASSWORD
Don't forget to run
pnpm sst deploy
to push changes, SST CLI will remind you in the terminal.
Finally, let's see if it works on local:
pnpm sst dev
Or if you're ready, push it live:
pnpm sst deploy