-
-
Notifications
You must be signed in to change notification settings - Fork 319
Expand file tree
/
Copy pathindex.js
More file actions
439 lines (423 loc) · 22.2 KB
/
index.js
File metadata and controls
439 lines (423 loc) · 22.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
import {Octokit} from "@octokit/rest"
import {Image, Link} from "blitz"
import {useEffect, useState} from "react"
import {ButtonLink} from "@/components/ButtonLink"
import {Header} from "@/components/Header"
import {Feature} from "@/components/home/Feature"
import {FeatureIcon} from "@/components/home/FeatureIcon"
import {FeatureIconTitle} from "@/components/home/FeatureIconTitle"
import {Footer} from "@/components/home/Footer"
import {Hand} from "@/components/home/Hand"
import {HeroCode} from "@/components/home/HeroCode"
import {StyledLink} from "@/components/home/StyledLink"
import {VideoPlayer} from "@/components/home/VideoPlayer"
import Scrollbar from "@/components/Scrollbar"
import {SocialCards} from "@/components/SocialCards"
import {SponsorPack} from "@/components/SponsorPack"
import {getGitHubFile} from "@/utils/getGitHubFile"
const Home = ({randomContributors}) => {
const [navIsOpen, setNavIsOpen] = useState(false)
useEffect(() => {
document.body.style.overflow = navIsOpen ? "hidden" : "unset"
}, [navIsOpen])
return (
<div>
<SocialCards imageUrl="/social-homepage.png" />
<div className="overflow-hidden">
<div>
<a name="top" aria-hidden>
{null}
</a>
<div className="relative grid grid-cols-1 pb-1 md:pb-3 gap-y-24 xl:gap-y-44">
<div className="z-30 text-white col-span-full">
<Header
className="px-6 mx-auto max-w-7xl"
onNavToggle={(isOpen) => {
setNavIsOpen(isOpen)
}}
/>
</div>
<div
className={
"absolute w-full h-full row-start-1 row-end-5 background-to-video rounded-bl-3xl xl:rounded-bl-4xl bg-gradient-to-b from-purple-mid to-purple-primary dark:from-black dark:to-purple-off-black " +
(navIsOpen ? "z-20 fixed" : "-z-10")
}
></div>
<div className="relative -mt-6 text-white col-span-full">
<div className="grid grid-cols-1 gap-10 px-6 mx-auto max-w-7xl lg:grid-cols-2 md:gap-6 xl:-mt-10">
<div className="z-10 lg:w-full">
<div className="flex flex-col -mt-8 lg:mt-16 xl:mt-10">
{/* html is ordered for SEO, then we use flex to flip display order for design */}
<h2 className="order-last font-medium text-2xl xl:text-3xl font-secondary xl:font-medium text-transparent bg-clip-text bg-gradient-to-r from-yellow-200 to-yellow-400 dark:from-yellow-100 dark:to-yellow-300">
The Missing Fullstack Toolkit for Next.js
</h2>
<h3 className="font-medium text-7xl font-secondary xl:text-8xl xl:font-medium text-transparent bg-clip-text bg-gradient-to-r from-blue-gradient-white to-blue-gradient-light-blue tracking-tight xl:tracking-tighter mb-4 xl:mb-8 ">
Ship. Fast.
</h3>
</div>
<p className="mt-6 xl:mt-8 text-lg xl:text-2xl xl:font-medium text-off-white lg:text-transparent lg:bg-clip-text lg:bg-gradient-to-r lg:from-blue-gradient-white lg:to-blue-gradient-light-blue ">
Blitz picks up where Next.js leaves off, providing battle-tested libraries and
conventions for shipping and scaling world wide applications.
</p>
<div className="flex space-x-4 mt-10">
<ButtonLink className="w-2/3 lg:w-auto rounded-tl-xl" href="/docs/why-blitz">
Learn to Blitz
</ButtonLink>
<ButtonLink
href="https://github.com/blitz-js/blitz"
target="_blank"
rel="noopener noreferrer"
variant="outline"
className="w-1/3 lg:w-auto rounded-r-xl"
>
GitHub
</ButtonLink>
</div>
</div>
<div className="relative lg:col-span-1">
<Hand variant="hero-squiggle" className="lg:hidden -right-6 -top-36" />
<Hand variant="hero-rightarm" className="hidden lg:block -left-36 top-32" />
<Hand
variant="hero-righthand"
className="z-20 hidden lg:block -left-4"
style={{top: "15.2rem"}}
/>
<Hand
variant="hero-leftarm"
className="hidden lg:block"
style={{top: "30rem", right: "-4.8rem"}}
/>
<Hand
variant="hero-lefthand"
style={{top: "26.6rem", right: "-2.2em"}}
className="z-20 hidden lg:block"
/>
<HeroCode className="z-10" />
</div>
</div>
</div>
<div className="z-10 px-6 mx-auto space-y-12 text-lg text-center text-white lg:space-y-0 lg:space-x-12 lg:flex lg:text-left max-w-7xl xl:font-mediumxl:text-xl">
<FeatureIcon icon="layers" heading="Typesafe API Layer">
Build and iterate on features 10x faster with Blitz RPC than REST, GraphQL, or
vanilla API routes. Read and write data from the client with full typesafety and
without messing with HTTP or serialization.
</FeatureIcon>
<FeatureIcon icon="lighteningBolt" heading="Authentication">
Powerful, flexible, and battle tested authentication and authorization for Next.js.
You get more control with simpler APIs than alternatives. Easily add social third
party integrations like Google, Github, and Auth0.
</FeatureIcon>
<FeatureIcon icon="graphUp" heading="Conventions & Codegen">
Set up a new app in 2 mins instead of 2 weeks. Everything will be set up for you
including auth, user signup, forgot password, and your form library of choice.
</FeatureIcon>
</div>
<div className="grid w-full gap-5 px-6 mx-auto text-white xl:gap-10 max-w-7xl lg:grid-cols-2">
<Link href="/#" passHref>
<StyledLink className="flex items-center justify-between pb-1 text-lg border-b border-opacity-50 border-blue-mid lg:col-span-2 font-secondary xl:text-xl">
<span>Top Videos</span>
{/*
<span className="flex items-center">
<span className="hidden mr-2 lg:block">View News</span>{" "}
<BsArrowRight size="1.5rem" />
</span>
*/}
</StyledLink>
</Link>
<VideoPlayer url="https://www.youtube.com/watch?v=8D8yox2clug" />
<VideoPlayer url="https://www.youtube.com/watch?v=TWkjl_jg3Jk" />
</div>
<div className="relative w-full mx-auto space-y-10 lg:space-y-20 xl:space-y-36 max-w-7xl">
<h2 className="px-6 text-3xl font-semibold xl:text-5xl xl:w-1/2">
Everything You Need For Production Apps
</h2>
<div className="w-full">
<Hand
variant="concepts-right"
className="hidden lg:block lg:-top-24 lg:-right-96 lg:w-8/12 xl:-top-14"
/>
<Scrollbar className="lg:hidden" thumbHeight="4px">
<div className="grid pb-4 ml-6 features-grid lg:gap-y-14">
<Feature title="Built for Monoliths and Services">
<p>
You can manage everything from the database to your frontend all inside a
single app. Only one thing to develop. Only one thing to deploy.
</p>
<p>Or not. Your choice.</p>
</Feature>
<Feature title="Loose Opinions">
<p>
The out-of-the-box experience guides you on a path perfect for most
applications. But when you need to go off the beaten path, you are totally
free to do so.
</p>
<p>
And nearly everything is pluggable. For example, we don't mandate which
styling or form libraries you use.
</p>
</Feature>
<Feature title="Convention over Configuration">
<p>
Blitz does all the boring set up and configuration for you. The common
project structure and architectural patterns make it easy to move from one
Blitz app to another and immediately feel at home.
</p>
</Feature>
<Feature title="Easy to Start, Easy to Scale">
<p>Easy for beginners and easy to migrate existing Next.js apps to Blitz.</p>
<p>
Easy to scale in all forms: lines of code, number of people working in the
codebase, and code execution.
</p>
</Feature>
</div>
</Scrollbar>
</div>
</div>
<div className="absolute w-full h-full row-start-6 lg:h-codesandbox lg:mt-80 row-end-10 md:row-end-10 rounded-bl-3xl rounded-tr-3xl lg:rounded-bl-4xl lg:rounded-tr-4xl bg-gradient-to-b from-purple-mid to-purple-primary dark:from-purple-off-black dark:to-black"></div>
<div className="relative hidden w-full px-6 mx-auto space-y-10 max-w-7xl lg:block">
<h3 className="pb-1 text-xs border-b border-opacity-50 font-secondary border-blue-mid">
Blitz CodeSandbox Example
</h3>
<div>
<Hand variant="sandbox-right" style={{right: "-13.2rem", bottom: "-35rem"}} />
<a
target="_blank"
rel="noopener noreferrer"
href="https://codesandbox.io/s/blitzjs-2-0-codesandbox-demo-b5v8xy?file=/app/blitz-server.ts"
className="h-sandbox xl:h-xl-sandbox block relative"
>
<Image
src="/img/sandbox-pic.png"
layout="fill"
className="object-cover"
alt="Codesandbox placeholder"
/>
<div className="absolute inset-0 bg-gray-800 opacity-0 hover:opacity-70 flex items-center justify-center text-white text-6xl font-bold">
Click to Open in New Tab
</div>
</a>
</div>
</div>
<div className="lg:hidden">{/*spacer div*/}</div>
<div className="relative flex flex-col px-6 mx-auto text-white lg:flex-row max-w-7xl space-y-14 lg:space-x-24 lg:space-y-0 xl:space-x-40">
<div className="space-y-14 lg:w-1/2">
<h2 className="z-10 font-medium text-transparent text-5xl-squashed font-secondary bg-clip-text bg-gradient-to-r from-blue-gradient-white to-blue-gradient-light-blue xl:text-6xl">
We Love Our Community!
</h2>
<div className="z-10 grid grid-cols-5 gap-1 md:grid-cols-6 lg:grid-cols-5 grid-rows-8 overflow-clip">
{randomContributors.map((contributor, i) => (
<a
href={`https://github.com/${contributor.login}`}
key={i}
target="_blank"
rel="noopener noreferrer"
>
<Image
layout="intrinsic"
width="100%"
height="100%"
src={contributor.avatar_url}
alt={contributor.name}
title={contributor.name}
className="w-full"
/>
</a>
))}
</div>
</div>
<div className="grid grid-cols-1 text-lg lg:relative gap-14 md:grid-cols-2 lg:row-span-2 lg:grid-cols-1 xl:text-xl lg:w-1/2">
<Hand variant="community-squiggle" className="xl:hidden -right-18" />
<div className="z-10 flex flex-col justify-between space-y-6 lg:justify-end">
<div className="flex flex-col space-y-6 lg:h-auto lg:text-transparent text-off-white">
<p className="lg:bg-gradient-to-r lg:from-blue-gradient-white lg:to-blue-gradient-light-blue lg:bg-clip-text">
Our community is warm, safe, inclusive, and fun!
<br />
Please read our{" "}
<Link href="/docs/code-of-conduct" passHref>
<StyledLink className="underline text-off-white hover:text-blue-light">
Code of Conduct
</StyledLink>
</Link>
.
</p>
</div>
<ButtonLink
href="https://discord.blitzjs.com/"
target="_blank"
rel="noopener noreferrer"
className="rounded-bl-none rounded-xl lg:w-max"
>
Join our Discord Community
</ButtonLink>
</div>
<div className="z-10 flex flex-col justify-between space-y-6 lg:justify-start">
<div className="flex flex-col space-y-6 lg:h-auto lg:text-transparent text-off-white lg:bg-clip-text lg:bg-gradient-to-r lg:from-blue-gradient-white lg:to-blue-gradient-light-blue">
<p className="lg:bg-gradient-to-r lg:from-blue-gradient-white lg:to-blue-gradient-light-blue lg:bg-clip-text">
We are all in this together, from the youngest to the oldest. We are all more
similar than we are different. We love to work together.
</p>
<p className="lg:bg-gradient-to-r lg:from-blue-gradient-white lg:to-blue-gradient-light-blue lg:bg-clip-text">
We invite you to help make Blitz the best JavaScript application layer
we've ever had!
</p>
</div>
<Link href="/docs/contributing" passHref>
<ButtonLink className="rounded-bl-none rounded-xl lg:w-max">
Learn How to Contribute
</ButtonLink>
</Link>
</div>
</div>
</div>
<div className="z-10 w-full mx-auto text-white space-y-7 max-w-7xl">
<h2 className="px-6 text-2xl font-medium text-white font-secondary lg:text-3xl">
Architecture Diagram
</h2>
<div className="w-full">
<Scrollbar className="lg:hidden" thumbHeight="4px" thumbColor="white">
<div className="px-6 architecture-diagram" style={{paddingBottom: "2px"}}>
{/* eslint-disable-next-line @next/next/no-img-element */}
<img src="img/architecture.svg" alt="Architecture diagram" />
</div>
</Scrollbar>
</div>
</div>
<div className="relative col-span-full">
<Hand variant="features-squiggle" className="-right-6 -top-10 xl:hidden -z-10" />
</div>
<div className="absolute w-full h-full row-start-8 row-end-19 xl:row-end-19 -z-20 bg-purple-mid dark:bg-purple-off-black"></div>
<div className="relative px-6 mx-auto my-6 space-y-12 text-white xl:my-0 max-w-7xl xl:space-y-36">
<h2 className="text-3xl font-semibold lg:text-transparent lg:bg-clip-text lg:bg-gradient-to-r lg:from-blue-gradient-white lg:to-blue-gradient-light-blue xl:text-5xl">
Everything End-to-End From <br className="hidden xl:block" />
the Database to the Frontend
</h2>
<div className="grid gap-12 md:grid-cols-2 xl:grid-cols-3">
<Hand
variant="features-right"
className="hidden xl:block xl:-top-40 xl:-right-52"
/>
<FeatureIconTitle icon="thumbsUp" title="Authentication & Authorization">
Blitz authentication is super easy and secure. Works with any identity provider,
including self-hosted username and password and third-parties like Auth0.
</FeatureIconTitle>
<FeatureIconTitle icon="database" title="Database Agnostic">
You can use any database you want. Prisma is the default database client, but you
can remove that and use anything else like Fauna or DynamoDB.
</FeatureIconTitle>
<FeatureIconTitle icon="fileCode" title="Recipes">
One command to install code and/or packages into your blitz app. Examples: `blitz
install tailwind` or `blitz install chakra-ui`. Recipes can be created by anyone.
</FeatureIconTitle>
<FeatureIconTitle icon="plugin" title="Backend Architecture">
Blitz is set up for server intensive tasks like sending emails, cron jobs,
background processing, generating PDFs, etc. Currently we have minimal backend
guides, but are working on developing more patterns and adding more docs.
</FeatureIconTitle>
<FeatureIconTitle icon="typescript" title="First Class TypeScript Support">
Blitz is built with TypeScript and the Blitz data layer is fully end-to-end
typesafe. All types are completely static without needing a separate type
generation process!
</FeatureIconTitle>
<FeatureIconTitle icon="scaffolding" title="Code Scaffolding">
Blitz code scaffolding is great for both prototyping and for building real apps!
You can override templates with your own.
</FeatureIconTitle>
</div>
</div>
<div className="absolute w-full h-full bg-white dark:bg-black row-start-11 row-end-13 rounded-tr-3xl xl:rounded-tr-4xl -z-10" />
<div className="relative col-span-full">
<Hand
variant="sponsors-squiggle"
className="-right-24 xl:hidden"
style={{top: "-5.3rem"}}
/>
</div>
<div className="px-6 mx-auto w-full text-center max-w-7xl ">
<div className="space-y-7 xl:space-y-10">
<h2 className="relative text-3xl font-semibold xl:text-5xl">
<Hand
variant="sponsors-left"
className="hidden xl:block -left-80 pointer-events-none"
style={{top: "-18.05rem"}}
/>
Our Sponsors
</h2>
<p className="text-lg xl:text-xl">
Your financial contributions help ensure Blitz continues to be developed and{" "}
<br className="hidden lg:block" />
maintained! We have monthly sponsorship options starting at $5/month.
</p>
<div>
<ButtonLink
variant="solid-dark"
href="https://github.com/sponsors/blitz-js"
className="mx-auto rounded-bl-none rounded-xl lg:w-max md:w-1/3 lg:m-auto lg:mt-4 xl:mt-18"
target="_blank"
rel="noopener noreferrer"
>
Support Blitz
</ButtonLink>
</div>
</div>
<div className="xl:max-w-2xl mx-auto">
<SponsorPack />
</div>
</div>
<div className="w-full px-6 mx-auto space-y-12 text-white lg:space-x-4 lg:space-y-0 lg:flex lg:items-center max-w-7xl">
<h2 className="pr-2 text-3xl font-semibold lg:w-full lg:text-transparent lg:bg-clip-text lg:bg-gradient-to-r lg:from-blue-gradient-white lg:to-blue-gradient-light-blue xl:text-5xl">
So What Should I Do Now?
</h2>
<div className="flex flex-col w-full space-y-4 md:flex-row md:space-y-0 md:space-x-2 min-h-10">
<ButtonLink
href="/docs/get-started"
className="w-full text-lg py-18 rounded-t-2xl md:rounded-tr-none"
>
Try Blitz in Under 5 Mins
</ButtonLink>
<ButtonLink
target="_blank"
rel="noopener noreferrer"
href="https://discord.blitzjs.com"
className="w-full text-lg py-18 rounded-br-2xl md:rounded-tr-2xl"
>
Join Discord
</ButtonLink>
</div>
</div>
<Footer className="dark:bg-purple-off-black bg-purple-mid text-white" />
</div>
</div>
</div>
</div>
)
}
const getStaticProps = async () => {
const MAX_CONTRIBUTORS = 30
const octokit = new Octokit({
auth: process.env.GITHUB_AUTH_TOKEN,
})
const {contributors} = await getGitHubFile({
octokit,
owner: "blitz-js",
repo: "blitz",
path: ".all-contributorsrc",
json: true,
})
let randomIndexes = []
while (randomIndexes.length < MAX_CONTRIBUTORS) {
var r = Math.floor(Math.random() * contributors.length)
if (randomIndexes.indexOf(r) === -1) randomIndexes.push(r)
}
let randomContributors = randomIndexes.map((i) => contributors[i])
return {
props: {randomContributors},
revalidate: 60 * 30, // 30 minutes
}
}
Home.meta = {
title: "Blitz.js - The Missing Fullstack Toolkit for Next.js",
description: `Blitz picks up where Next.js leaves off, providing battle-tested libraries and conventions for shipping and scaling world wide applications.`,
}
export default Home
export {getStaticProps}