Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion apps/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
},
"exports": {
".": "./src/index.ts",
"./data": "./src/data.ts",
"./shared": "./src/shared.ts"
},
"prisma": {
Expand Down
1 change: 0 additions & 1 deletion apps/backend/src/data.ts

This file was deleted.

56 changes: 33 additions & 23 deletions apps/backend/src/lib/Mailer.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import SMTPTransport from "nodemailer/lib/smtp-transport"
import { SmtpSettings } from "../../prisma/client"
import nodemailer from "nodemailer"

Expand Down Expand Up @@ -32,38 +33,47 @@ interface SendEmailResponse {
messageId?: string
}

type TransportOptions = SMTPTransport | SMTPTransport.Options | string

export class Mailer {
private transporter: nodemailer.Transporter

constructor(smtpSettings: SmtpSettings) {
const startTls = {
port: 587,
secure: false,
requireTLS: true,
}

const sslTls = {
port: 465,
secure: true,
}

const tlsOpts =
smtpSettings.encryption === "STARTTLS"
? startTls
: smtpSettings.encryption === "SSL_TLS"
? sslTls
: { port: smtpSettings.port }

this.transporter = nodemailer.createTransport({
connectionTimeout: smtpSettings.timeout,
let transportOptions: TransportOptions = {
host: smtpSettings.host,
port: smtpSettings.port,
connectionTimeout: smtpSettings.timeout,
auth: {
user: smtpSettings.username,
pass: smtpSettings.password,
},
requireTLS: smtpSettings.secure,
...tlsOpts,
})
}

if (smtpSettings.encryption === "STARTTLS") {
transportOptions = {
...transportOptions,
port: smtpSettings.port || 587, // Default STARTTLS port
secure: false, // Use STARTTLS
requireTLS: true, // Require STARTTLS upgrade
}
} else if (smtpSettings.encryption === "SSL_TLS") {
transportOptions = {
...transportOptions,
port: smtpSettings.port || 465, // Default SSL/TLS port
secure: true, // Use direct TLS connection
}
} else {
// NONE encryption
transportOptions = {
...transportOptions,
port: smtpSettings.port || 25, // Default non-encrypted port
secure: false,
requireTLS: false, // Explicitly disable TLS requirement
ignoreTLS: true, // Optionally ignore TLS advertised by server if needed
}
}

this.transporter = nodemailer.createTransport(transportOptions)
}

async sendEmail(options: SendMailOptions): Promise<SendEmailResponse> {
Expand Down
1 change: 1 addition & 0 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@repo/shared": "workspace:*",
"next": "15.1.7",
"nextra": "^4.2.11",
"nextra-theme-docs": "^4.2.11",
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/app/getting-started/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ We've made LetterSpace for simplicity and ease of use. The easiest way to get st
- app_network

backend:
image: ghcr.io/dcodesdev/letterspace:0.2.1-beta
image: ghcr.io/dcodesdev/letterspace:0.2.4-beta
restart: always
depends_on:
- db
Expand Down
1 change: 1 addition & 0 deletions apps/landing-page/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
},
"dependencies": {
"@repo/ui": "workspace:*",
"@repo/shared": "workspace:*",
"lucide-react": "^0.474.0",
"next": "15.3.1",
"react": "^19.0.0",
Expand Down
4 changes: 3 additions & 1 deletion apps/landing-page/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { APP_VERSION } from "@repo/shared"

export const constants = {
env: {
DOCS_URL: process.env.NEXT_PUBLIC_DOCS_URL!,
GITHUB_URL: process.env.NEXT_PUBLIC_GITHUB_URL!,
X_URL: "https://x.com/dcodesdev",
},
version: "v0.1.0",
version: APP_VERSION,
}

Object.entries(constants.env).forEach(([key, value]) => {
Expand Down
1 change: 1 addition & 0 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"dependencies": {
"@hookform/resolvers": "^5.0.1",
"@repo/ui": "workspace:*",
"@repo/shared": "workspace:*",
"@tabler/icons-react": "^3.31.0",
"@tanstack/react-query": "^5.75.2",
"@tanstack/react-table": "^8.21.3",
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/pages/dashboard/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
import { useSession } from "@/hooks"
import { useLocation } from "react-router"
import { ThemeToggle, WithTooltip } from "@/components"
import { VERSION } from "backend/data"
import { APP_VERSION } from "@repo/shared"

const sidebarItems = [
{
Expand Down Expand Up @@ -197,7 +197,7 @@ export function DashboardLayout() {
<div className="flex items-center justify-between gap-2 px-2">
<WithTooltip content="Current version">
<span className="text-xs text-muted-foreground hover:text-foreground transition-colors">
v{VERSION}
v{APP_VERSION}
</span>
</WithTooltip>
</div>
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"version": "0.2.4-beta",
"name": "letterspace",
"private": true,
"scripts": {
Expand Down
34 changes: 34 additions & 0 deletions packages/shared/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# dependencies (bun install)
node_modules

# output
out
dist
*.tgz

# code coverage
coverage
*.lcov

# logs
logs
_.log
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# caches
.eslintcache
.cache
*.tsbuildinfo

# IntelliJ based IDEs
.idea

# Finder (MacOS) folder config
.DS_Store
3 changes: 3 additions & 0 deletions packages/shared/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import packageJson from "../../package.json"

export const APP_VERSION = packageJson.version
12 changes: 12 additions & 0 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "@repo/shared",
"module": "index.ts",
"type": "module",
"main": "index.ts",
"devDependencies": {
"@types/bun": "latest"
},
"peerDependencies": {
"typescript": "^5"
}
}
28 changes: 28 additions & 0 deletions packages/shared/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"compilerOptions": {
// Environment setup & latest features
"lib": ["ESNext"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,

// Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,

// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,

// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false
}
}
Loading