Skip to content

Commit 5c96005

Browse files
waleedlatifwaleedlatif
authored andcommitted
added CDN for large assets with fallback to static assets
1 parent abed816 commit 5c96005

File tree

11 files changed

+52
-27
lines changed

11 files changed

+52
-27
lines changed

apps/sim/app/(landing)/components/sections/blogs.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { motion } from 'framer-motion'
44
import { BlogCard } from '@/app/(landing)/components/blog-card'
5+
import { getAssetUrl } from '@/lib/utils'
56

67
function Blogs() {
78
return (
@@ -50,7 +51,7 @@ function Blogs() {
5051
date={new Date('25 April 2025')}
5152
author='Emir Ayaz'
5253
authorRole='Designer'
53-
avatar='/static/sim.png'
54+
avatar={getAssetUrl('static/sim.png')}
5455
type='Agents'
5556
readTime='6'
5657
/>
@@ -61,7 +62,7 @@ function Blogs() {
6162
date={new Date('25 April 2025')}
6263
author='Emir Ayaz'
6364
authorRole='Designer'
64-
avatar='/static/sim.png'
65+
avatar={getAssetUrl('static/sim.png')}
6566
type='Agents'
6667
readTime='6'
6768
/>
@@ -80,18 +81,18 @@ function Blogs() {
8081
date={new Date('25 April 2025')}
8182
author='Emir Ayaz'
8283
authorRole='Designer'
83-
avatar='/static/sim.png'
84+
avatar={getAssetUrl('static/sim.png')}
8485
type='Agents'
8586
readTime='6'
86-
image='/static/hero.png'
87+
image={getAssetUrl('static/hero.png')}
8788
/>
8889
<BlogCard
8990
href='/blog/test'
9091
title='How to Build an Agent in 5 Steps with SimStudio.ai'
9192
description="Learn how to create a fully functional AI agent using SimStudio.ai's unified API and workflows."
9293
author='Emir Ayaz'
9394
authorRole='Designer'
94-
avatar='/static/sim.png'
95+
avatar={getAssetUrl('static/sim.png')}
9596
type='Agents'
9697
readTime='6'
9798
/>
@@ -110,7 +111,7 @@ function Blogs() {
110111
date={new Date('25 April 2025')}
111112
author='Emir Ayaz'
112113
authorRole='Designer'
113-
avatar='/static/sim.png'
114+
avatar={getAssetUrl('static/sim.png')}
114115
type='Agents'
115116
readTime='6'
116117
/>
@@ -121,7 +122,7 @@ function Blogs() {
121122
date={new Date('25 April 2025')}
122123
author='Emir Ayaz'
123124
authorRole='Designer'
124-
avatar='/static/sim.png'
125+
avatar={getAssetUrl('static/sim.png')}
125126
type='Functions'
126127
readTime='6'
127128
/>

apps/sim/app/(landing)/components/sections/testimonials.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,70 +3,71 @@
33
import { motion } from 'framer-motion'
44
import useIsMobile from '@/app/(landing)/components/hooks/use-is-mobile'
55
import { Marquee } from '@/app/(landing)/components/magicui/marquee'
6+
import { getAssetUrl } from '@/lib/utils'
67

78
const X_TESTIMONIALS = [
89
{
910
text: "Drag-and-drop AI workflows for devs who'd rather build agents than babysit them.",
1011
username: '@GithubProjects',
1112
viewCount: '90.4k',
1213
tweetUrl: 'https://x.com/GithubProjects/status/1906383555707490499',
13-
profileImage: '/twitter/github-projects.jpg',
14+
profileImage: getAssetUrl('twitter/github-projects.jpg'),
1415
},
1516
{
1617
text: 'A very good looking agent workflow builder 🔥 and open source!',
1718
username: '@xyflowdev',
1819
viewCount: '3,246',
1920
tweetUrl: 'https://x.com/xyflowdev/status/1909501499719438670',
20-
profileImage: '/twitter/xyflow.jpg',
21+
profileImage: getAssetUrl('twitter/xyflow.jpg'),
2122
},
2223
{
2324
text: "🚨 BREAKING: This startup just dropped the fastest way to build AI agents.\n\nThis Figma-like canvas to build agents will blow your mind.\n\nHere's why this is the best tool for building AI agents:",
2425
username: '@hasantoxr',
2526
viewCount: '515k',
2627
tweetUrl: 'https://x.com/hasantoxr/status/1912909502036525271',
27-
profileImage: '/twitter/hasan.jpg',
28+
profileImage: getAssetUrl('twitter/hasan.jpg'),
2829
},
2930
{
3031
text: 'omfggggg this is the zapier of agent building\n\ni always believed that building agents and using ai should not be limited to technical people. i think this solves just that\n\nthe fact that this is also open source makes me so optimistic about the future of building with ai :)))\n\ncongrats @karabegemir & @typingwala !!!',
3132
username: '@nizzyabi',
3233
viewCount: '6,269',
3334
tweetUrl: 'https://x.com/nizzyabi/status/1907864421227180368',
34-
profileImage: '/twitter/nizzy.jpg',
35+
profileImage: getAssetUrl('twitter/nizzy.jpg'),
3536
},
3637
{
3738
text: "One of the best products I've seen in the space, and the hustle and grind I've seen from @karabegemir and @typingwala is insane. Sim Studio is positioned to build something game-changing, and there's no better team for the job.\n\nCongrats on the launch 🚀 🎊 great things ahead!",
3839
username: '@firestorm776',
3940
viewCount: '956',
4041
tweetUrl: 'https://x.com/firestorm776/status/1907896097735061598',
41-
profileImage: '/twitter/samarth.jpg',
42+
profileImage: getAssetUrl('twitter/samarth.jpg'),
4243
},
4344
{
4445
text: 'lfgg got access to @simstudioai via @zerodotemail 😎',
4546
username: '@nizzyabi',
4647
viewCount: '1,585',
4748
tweetUrl: 'https://x.com/nizzyabi/status/1910482357821595944',
48-
profileImage: '/twitter/nizzy.jpg',
49+
profileImage: getAssetUrl('twitter/nizzy.jpg'),
4950
},
5051
{
5152
text: 'Feels like we\'re finally getting a "Photoshop moment" for AI devs—visual, intuitive, and fast enough to keep up with ideas mid-flow.',
5253
username: '@syamrajk',
5354
viewCount: '2,643',
5455
tweetUrl: 'https://x.com/syamrajk/status/1912911980110946491',
55-
profileImage: '/twitter/syamrajk.jpg',
56+
profileImage: getAssetUrl('twitter/syamrajk.jpg'),
5657
},
5758
{
5859
text: "🚨 BREAKING: This startup just dropped the fastest way to build AI agents.\n\nThis Figma-like canvas to build agents will blow your mind.\n\nHere's why this is the best tool for building AI agents:",
5960
username: '@lazukars',
6061
viewCount: '47.4k',
6162
tweetUrl: 'https://x.com/lazukars/status/1913136390503600575',
62-
profileImage: '/twitter/lazukars.png',
63+
profileImage: getAssetUrl('twitter/lazukars.png'),
6364
},
6465
{
6566
text: 'The use cases are endless. Great work @simstudioai',
6667
username: '@daniel_zkim',
6768
viewCount: '103',
6869
tweetUrl: 'https://x.com/daniel_zkim/status/1907891273664782708',
69-
profileImage: '/twitter/daniel.jpg',
70+
profileImage: getAssetUrl('twitter/daniel.jpg'),
7071
},
7172
]
7273

apps/sim/app/layout.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { PublicEnvScript } from 'next-runtime-env'
55
import { env, isTruthy } from '@/lib/env'
66
import { createLogger } from '@/lib/logs/console/logger'
77
import { TelemetryConsentDialog } from '@/app/telemetry-consent-dialog'
8+
import { getAssetUrl } from '@/lib/utils'
89
import '@/app/globals.css'
910

1011
import { ZoomPrevention } from '@/app/zoom-prevention'
@@ -118,7 +119,7 @@ export const metadata: Metadata = {
118119
siteName: 'Sim Studio',
119120
images: [
120121
{
121-
url: 'https://simstudio.ai/social/facebook.png',
122+
url: getAssetUrl('social/facebook.png'),
122123
width: 1200,
123124
height: 630,
124125
alt: 'Sim Studio',
@@ -130,7 +131,7 @@ export const metadata: Metadata = {
130131
title: 'Sim Studio',
131132
description:
132133
'Build and deploy AI agents using our Figma-like canvas. Build, write evals, and deploy AI agent workflows that automate workflows and streamline your business processes.',
133-
images: ['https://simstudio.ai/social/twitter.png'],
134+
images: [getAssetUrl('social/twitter.png')],
134135
creator: '@simstudioai',
135136
site: '@simstudioai',
136137
},
@@ -231,7 +232,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
231232
<meta name='twitter:domain' content='simstudio.ai' />
232233

233234
{/* Additional image sources */}
234-
<link rel='image_src' href='https://simstudio.ai/social/facebook.png' />
235+
<link rel='image_src' href={getAssetUrl('social/facebook.png')} />
235236

236237
<PublicEnvScript />
237238
</head>

apps/sim/components/emails/footer.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Container, Img, Link, Section, Text } from '@react-email/components'
22
import { env } from '@/lib/env'
3+
import { getAssetUrl } from '@/lib/utils'
34

45
interface UnsubscribeOptions {
56
unsubscribeToken?: string
@@ -25,13 +26,13 @@ export const EmailFooter = ({
2526
<tr>
2627
<td align='center' style={{ padding: '0 8px' }}>
2728
<Link href='https://x.com/simstudioai' rel='noopener noreferrer'>
28-
<Img src={`${baseUrl}/static/x-icon.png`} width='24' height='24' alt='X' />
29+
<Img src={getAssetUrl('static/x-icon.png')} width='24' height='24' alt='X' />
2930
</Link>
3031
</td>
3132
<td align='center' style={{ padding: '0 8px' }}>
3233
<Link href='https://discord.gg/Hr4UWYEcTT' rel='noopener noreferrer'>
3334
<Img
34-
src={`${baseUrl}/static/discord-icon.png`}
35+
src={getAssetUrl('static/discord-icon.png')}
3536
width='24'
3637
height='24'
3738
alt='Discord'
@@ -41,7 +42,7 @@ export const EmailFooter = ({
4142
<td align='center' style={{ padding: '0 8px' }}>
4243
<Link href='https://github.com/simstudioai/sim' rel='noopener noreferrer'>
4344
<Img
44-
src={`${baseUrl}/static/github-icon.png`}
45+
src={getAssetUrl('static/github-icon.png')}
4546
width='24'
4647
height='24'
4748
alt='GitHub'

apps/sim/components/emails/invitation-email.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
} from '@react-email/components'
1414
import { format } from 'date-fns'
1515
import { env } from '@/lib/env'
16+
import { getAssetUrl } from '@/lib/utils'
1617
import { baseStyles } from './base-styles'
1718
import EmailFooter from './footer'
1819

@@ -59,7 +60,7 @@ export const InvitationEmail = ({
5960
<Row>
6061
<Column style={{ textAlign: 'center' }}>
6162
<Img
62-
src={`${baseUrl}/static/sim.png`}
63+
src={getAssetUrl('static/sim.png')}
6364
width='114'
6465
alt='Sim Studio'
6566
style={{

apps/sim/components/emails/otp-verification-email.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
Text,
1212
} from '@react-email/components'
1313
import { env } from '@/lib/env'
14+
import { getAssetUrl } from '@/lib/utils'
1415
import { baseStyles } from './base-styles'
1516
import EmailFooter from './footer'
1617

@@ -68,7 +69,7 @@ export const OTPVerificationEmail = ({
6869
<Row>
6970
<Column style={{ textAlign: 'center' }}>
7071
<Img
71-
src={`${baseUrl}/static/sim.png`}
72+
src={getAssetUrl('static/sim.png')}
7273
width='114'
7374
alt='Sim Studio'
7475
style={{

apps/sim/components/emails/reset-password-email.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
} from '@react-email/components'
1414
import { format } from 'date-fns'
1515
import { env } from '@/lib/env'
16+
import { getAssetUrl } from '@/lib/utils'
1617
import { baseStyles } from './base-styles'
1718
import EmailFooter from './footer'
1819

@@ -39,7 +40,7 @@ export const ResetPasswordEmail = ({
3940
<Row>
4041
<Column style={{ textAlign: 'center' }}>
4142
<Img
42-
src={`${baseUrl}/static/sim.png`}
43+
src={getAssetUrl('static/sim.png')}
4344
width='114'
4445
alt='Sim Studio'
4546
style={{

apps/sim/components/emails/workspace-invitation.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
Text,
1313
} from '@react-email/components'
1414
import { env } from '@/lib/env'
15+
import { getAssetUrl } from '@/lib/utils'
1516
import { baseStyles } from './base-styles'
1617
import EmailFooter from './footer'
1718

@@ -56,7 +57,7 @@ export const WorkspaceInvitationEmail = ({
5657
<Row>
5758
<Column style={{ textAlign: 'center' }}>
5859
<Img
59-
src={`${baseUrl}/static/sim.png`}
60+
src={getAssetUrl('static/sim.png')}
6061
width='114'
6162
alt='Sim Studio'
6263
style={{

apps/sim/lib/env.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ export const env = createEnv({
152152
NEXT_PUBLIC_SENTRY_DSN: z.string().url().optional(), // Sentry DSN for client-side error tracking
153153
NEXT_PUBLIC_SOCKET_URL: z.string().url().optional(), // WebSocket server URL for real-time features
154154

155+
// Asset Storage
156+
NEXT_PUBLIC_BLOB_BASE_URL: z.string().url().optional(), // Base URL for Vercel Blob storage (CDN assets)
157+
155158
// Google Services - For client-side Google integrations
156159
NEXT_PUBLIC_GOOGLE_CLIENT_ID: z.string().optional(), // Google OAuth client ID for browser auth
157160
NEXT_PUBLIC_GOOGLE_API_KEY: z.string().optional(), // Google API key for client-side API calls
@@ -168,6 +171,7 @@ export const env = createEnv({
168171
NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL,
169172
NEXT_PUBLIC_VERCEL_URL: process.env.NEXT_PUBLIC_VERCEL_URL,
170173
NEXT_PUBLIC_SENTRY_DSN: process.env.NEXT_PUBLIC_SENTRY_DSN,
174+
NEXT_PUBLIC_BLOB_BASE_URL: process.env.NEXT_PUBLIC_BLOB_BASE_URL,
171175
NEXT_PUBLIC_GOOGLE_CLIENT_ID: process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID,
172176
NEXT_PUBLIC_GOOGLE_API_KEY: process.env.NEXT_PUBLIC_GOOGLE_API_KEY,
173177
NEXT_PUBLIC_GOOGLE_PROJECT_NUMBER: process.env.NEXT_PUBLIC_GOOGLE_PROJECT_NUMBER,

apps/sim/lib/security/csp.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export const cspDirectives: CSPDirectives = {
4949
'https://*.atlassian.com',
5050
'https://cdn.discordapp.com',
5151
'https://*.githubusercontent.com',
52+
'https://*.public.blob.vercel-storage.com',
5253
],
5354

5455
'media-src': ["'self'", 'blob:'],

0 commit comments

Comments
 (0)