04d0f4b123
* feat: support standard AWS env vars and default credential chain Replace non-standard AWS_ACCESS_KEY / AWS_SECRET_KEY with the AWS-standard AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY. The old names are kept as fallbacks in the runtimeEnv for backward compatibility. Both vars are now optional. When omitted, the credentials object is not passed to SESv2Client, STSClient, or SNSClient — the AWS SDK then falls back to its default provider chain (IAM roles, ECS task roles, instance profiles, etc.), which is the recommended approach for cloud-native deployments. Closes #316 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * refactor: extract shared getAwsCredentialOptions helper and add partial-config guard - Move the credential spread logic into a single credentials.ts helper so SESv2Client, STSClient, and SNSClient all share one implementation - Throw a clear error if only one of AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY is set, preventing silent fallback to the default provider chain with a half-configured environment Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: align AWS env vars in docker and docs * fix: use alias import for AWS credentials helper --------- Co-authored-by: purva <purvahk08@gmail.com> Co-authored-by: Purva Kandalgaonkar <136103488+purva-8@users.noreply.github.com>
115 lines
3.7 KiB
Plaintext
115 lines
3.7 KiB
Plaintext
---
|
||
title: Self hosting with Railway
|
||
description: Deploy useSend on Railway with one click.
|
||
---
|
||
|
||
useSend is a [Railway Partner](https://railway.app/partners?utm_medium=integration&utm_source=docs&utm_campaign=usesend) and Railway offers the quickest way to get a useSend instance running.
|
||
|
||
[](https://railway.com/deploy/usesend?utm_medium=integration&utm_source=docs&utm_campaign=usesend)
|
||
|
||
## Prerequisites
|
||
|
||
- A [GitHub](https://github.com) account
|
||
- An [AWS](https://aws.amazon.com) account
|
||
|
||
If you have any questions join [#self-host](https://discord.gg/gbsvjb9MqV) on discord.
|
||
|
||
## Step 1: Deploy on Railway
|
||
|
||
1. Click the button above and choose **Deploy now**.
|
||
2. Wait for the deployment to complete and open the service.
|
||
3. Note the assigned Railway domain (you can add a custom domain later).
|
||
4. You can redeploy from the dashboard anytime to pull the latest image.
|
||
|
||
## Step 2: Environment variables
|
||
|
||
useSend depends on AWS SES to send emails and SNS to receive email status. The Railway template provisions Postgres (database) and Redis (queue) automatically—no action needed for those. Add the following variables under your service’s Variables tab.
|
||
|
||
<Steps>
|
||
<Step title="AWS credentials">
|
||
tl;dr: In the AWS Console, create a new IAM user with programmatic access. Attach `AmazonSNSFullAccess` and `AmazonSESFullAccess`. Then create an access key.
|
||
|
||
Add the following environment variables in Railway.
|
||
|
||
```env
|
||
AWS_ACCESS_KEY_ID=<access-key-id>
|
||
AWS_SECRET_ACCESS_KEY=<secret-access-key>
|
||
```
|
||
|
||
<Tip>
|
||
Follow this for detailed steps: [Create AWS
|
||
credentials](/get-started/create-aws-credentials)
|
||
</Tip>
|
||
</Step>
|
||
|
||
<Step title="GitHub app credentials for login">
|
||
useSend uses GitHub authentication for login.
|
||
|
||
Use this link to [create a GitHub app](https://docs.github.com/en/apps/creating-github-apps/about-creating-github-apps/about-creating-github-apps)
|
||
|
||
Callback URL : `https://<your-railway-domain>/api/auth/callback/github`
|
||
|
||

|
||
|
||
Add the following environment variables in Railway.
|
||
|
||
```env
|
||
GITHUB_ID="<your-github-client-id>"
|
||
GITHUB_SECRET="<your-github-client-secret>"
|
||
```
|
||
|
||
</Step>
|
||
|
||
<Step title="NextAuth URL">
|
||
Set your public app URL for NextAuth.
|
||
|
||
Add the following variables in Railway:
|
||
|
||
```env
|
||
NEXTAUTH_URL="https://<your-railway-domain>"
|
||
```
|
||
|
||
</Step>
|
||
</Steps>
|
||
|
||
<Tip>
|
||
After adding variables, click **Redeploy** so the service picks up the new
|
||
configuration.
|
||
</Tip>
|
||
|
||
## Step 3: Optional — Custom domain
|
||
|
||
- Add a custom domain in Railway and configure DNS.
|
||
- Update `NEXTAUTH_URL` to your new domain (e.g., `https://mail.yourdomain.com`).
|
||
- Redeploy to apply the change.
|
||
|
||
## Step 4: Set up SES region in useSend
|
||
|
||
In order to send emails, you need to select a region in AWS. Use a region where your users are located / where useSend is hosted. If you're unsure, use `us-east-1`.
|
||
|
||
You can check available regions [here](https://docs.aws.amazon.com/general/latest/gr/ses.html)
|
||
|
||
Once you log in to useSend, it will prompt you add SES configuration.
|
||
|
||
- Add the region
|
||
- Add the callback url, which is basically the app url. Note this should be accessible from the internet. This is how you get the delivery status of the emails.
|
||
- You don't need to update the send rate, it's automatically based on your account.
|
||
|
||

|
||
|
||
## Step 5: Get out of SES sandbox
|
||
|
||
<Warning>Don't forget to get the SES account out of sandbox mode.</Warning>
|
||
|
||

|
||
|
||
## Next steps
|
||
|
||
You're all set up.
|
||
|
||
- Set up a domain.
|
||
- Create an API key.
|
||
- Start sending emails.
|
||
|
||
If you have any questions, please join [#self-host](https://discord.gg/gbsvjb9MqV) on discord.
|