• Stars
    star
    673
  • Rank 67,060 (Top 2 %)
  • Language Svelte
  • License
    MIT License
  • Created over 3 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An opinionated blog starter for SvelteKit + Tailwind + Netlify. Refreshed for SvelteKit 1.0!

SwyxKit

A lightly opinionated starter for SvelteKit blogs:

Feel free to rip out these opinions as you see fit of course.

"Does anyone know what theme that blog is using? It looks really nice." - anon

Live Demo

See https://swyxkit.netlify.app/ (see Deploy Logs)

screenshot of swyxkit in action

screenshot of swyxkit in action

Users in the wild

Key Features and Design Considerations

Features

All the basic things I think a developer website should have.

Performance/Security touches

Fast (check the lighthouse scores) and secure.

Minor design/UX touches

The devil is in the details.

Developer Experience

Making this easier to maintain and focus on writing not coding.

Overall, this is a partial implementation of https://www.swyx.io/the-surprisingly-high-table-stakes-of-modern-blogs/

Setup

Step 0: Clone project (and deploy)

npx degit https://github.com/sw-yx/swyxkit
export GH_TOKEN=your_gh_token_here # Can be skipped if just trying out this repo casually
npm install
npm run start # Launches site locally at http://localhost:5173/ 
# you can also npm run dev to spin up histoire at http://localhost:6006/

You should be able to deploy this project straight to Netlify as is, just like this project is. This project recently switched to use sveltejs/adapter-auto, so you should also be able to deploy to Vercel and Cloudflare, but these 2 deploy targets are not regularly tested (please report/help fix issues if you find them)!

However, to have new posts show up, you will need to personalize the siteConfig (see next step) - take note of APPROVED_POSTERS_GH_USERNAME in particular (this is an allowlist of people who can post to the blog by opening a GitHub issue, otherwise any rando can blog and that's not good).

Deploy to Netlify

# These are just untested, suggested commands, use your discretion to hook it up or deploy wherever
git init
git add .
git commit -m "initial commit"
gh repo create # Make a new public GitHub repo and name it whatever
git push origin master
ntl init # Use the Netlify cli to deploy, assuming you already installed it and logged in. You can also use `ntl deploy`

Step 1: Personalization Configuration

As you become ready to seriously adopt this, remember to configure /lib/siteConfig.js - just some hardcoded vars I want you to remember to configure.

export const SITE_URL = 'https://swyxkit.netlify.app';
export const APPROVED_POSTERS_GH_USERNAME = ['sw-yx']; // IMPORTANT: change this to at least your GitHub username, or add others if you want
export const GH_USER_REPO = 'sw-yx/swyxkit'; // Used for pulling GitHub issues and offering comments
export const REPO_URL = 'https://github.com/' + GH_USER_REPO;
export const SITE_TITLE = 'SwyxKit';
export const SITE_DESCRIPTION = "swyx's default SvelteKit + Tailwind starter";
export const DEFAULT_OG_IMAGE =
	'https://user-images.githubusercontent.com/6764957/147861359-3ad9438f-41d1-47c8-aa05-95c7d18497f0.png';
export const MY_TWITTER_HANDLE = 'swyx';
export const MY_YOUTUBE = 'https://youtube.com/swyxTV';
export const POST_CATEGORIES = ['Blog']; // Other categories you can consider adding: Talks, Tutorials, Snippets, Podcasts, Notes...
export const GH_PUBLISHED_TAGS = ['Published']; // List of allowed issue labels, only the issues having at least one of these labels will show on the blog.

Of course, you should then go page by page (there aren't that many) and customize some of the other hardcoded items, for example:

  • Add the Utterances GitHub app to your repo/account to let visitors comment nicely if logged in.
  • The src/Newsletter.svelte component needs to be wired up to a newsletter service (I like Buttondown and TinyLetter). Or you can remove it of course.
  • Page Cache-Control policy and SvelteKit maxage
  • Site favicons (use https://realfavicongenerator.net/ to make all the variants and stick it in /static)
  • (If migrating content from previous blog) setup Netlify redirects at /static/_redirects

This blog uses GitHub as a CMS - if you are doing any serious development at all, you should give the GH_TOKEN env variable to raise rate limit from 60 to 5000.

Step 2: Make your first post

Open a new GitHub issue on your new repo, write some title and markdown in the body, add a Published tag (or any one of the label set in GH_PUBLISHED_TAGS), and then save.

You should see it refetched in local dev or in the deployed site pretty quickly. You can configure SvelteKit to build each blog page up front, or on demand. Up to you to trade off speed and flexibility.

Here's a full reference of the YAML frontmatter that swyxkit recognizes - ALL of this is optional and some of have aliases you can discover in /src/lib/content.js. Feel free to customize/simplify of course.

---
title: my great title
subtitle: my great subtitle
description: my great description
slug: my-title
tags: [foo, bar, baz]
category: blog
image: https://my_image_url.com/img-4.png
date: 2023-04-22
canonical: https://official-site.com/my-title
---

my great intro

## my subtitle

lorem ipsum 

If your Published post (any post with one of the labels set in GH_PUBLISHED_TAGS) doesn't show up, you may have forgotten to set APPROVED_POSTERS_GH_USERNAME to your GitHub username in siteConfig.

If all of this is annoying feel free to rip out the GitHub Issues CMS wiring and do your own content pipeline, I'm not your boss. MDSveX is already set up in this repo if you prefer not having a disconnected content toolchain from your codebase (which is fine, I just like having it in a different place for a better editing experience). See also my blogpost on the benefits of using GitHub Issues as CMS.

Optimizations to try after you are done deploying

  • Customize your JSON+LD for FAQ pages, organization, or products. There is a schema for blogposts, but it is so dead simple that SwyxKit does not include it.
  • Have a process to submit your sitemap to Google? (or configure robots.txt and hope it works)
  • Testing: make sure you have run npx playwright install and then you can run npm run test

Further Reading

Acknowledgements

Todos

  • Implement ETag header for GitHub API
  • Store results in Netlify build cache
  • Separate hydration path for mobile nav (so that we could hydrate=false some pages)
  • Custom components in MDX, and rehype plugins
  • (maybe) Dynamic RSS in SvelteKit:
    • SvelteKit Endpoints don't take over from SvelteKit dynamic param routes ([slug].svelte has precedence over rss.xml.js)
      • Aug 2022: now solved due to PlusKit
    • RSS Endpoint runs locally but doesn't run in Netlify because there's no access to the content in prod (SvelteKit issue)

More Repositories

1

spark-joy

✨😂 2000+ ways to add design flair, user delight, and whimsy to your product.
9,387
star
2

ai-notes

notes for software engineers getting up to speed on new AI developments. Serves as datastore for https://latent.space writing, and product brainstorming, but has cleaned up canonical references under the /Resources folder.
2,778
star
3

brain

Swyx's second brain!
1,458
star
4

launch-cheatsheet

how smart people launch things - collected advice for beginner indiehackers, focused on pricing, landing pages, and everything else that you need going up to a launch.
852
star
5

awesome-dev-podcasts

a curated list of awesome dev podcasts and why they are awesome
664
star
6

cli-cheatsheet

helpful libraries for *building* CLIs. Not a list of CLIs.
618
star
7

devtools-angels

active angel investors in developer tools!
588
star
8

swyxdotio

This is the repo for swyx's blog - Blog content is created in github issues, then posted on swyx.io as blog pages! Comment/watch to follow along my blog within GitHub
Svelte
334
star
9

async-render-toolbox

BECAUSE PERFORMANCE SHOULD BE SEXY
JavaScript
320
star
10

gpt3-list

List of things that people are claiming is enabled by GPT3. unverified but links to sources.
267
star
11

svelte-actions

prototype official actions for Svelte
TypeScript
228
star
12

gh-action-data-scraping

this shows how to use github actions to do periodic data scraping
JavaScript
171
star
13

ssg

Svelte Site Generator. why try this? because sapper has a lot of setup, and isn't great at pipelining data:
TypeScript
165
star
14

fresh

Community curated lists that never go out of style! 🍅
137
star
15

page-transitions-react-travelapp

react port of https://github.com/sdras/page-transitions-travelapp. See the deployed metlife site:
JavaScript
93
star
16

ask-cli

a cli to ask questions of gpt3 and iterate/chain of thought
TypeScript
90
star
17

svelte-data-fetching

Data Fetching For Developers Who Are New to Svelte And Wanna Learn To Do Other Stuff Good Too
CSS
84
star
18

uuid-list

list of unique id implementations, design considerations, and resources.
84
star
19

sw-yx

readmeee
Python
80
star
20

netlify-plugin-search-index

Generate a Search Index you can query via a static JSON blob or a Netlify Function! A completely framework agnostic Netlify Build plugin that crawls your static site to generate a search index.
JavaScript
79
star
21

automation

bots and their source
75
star
22

gatsby-netlify-form-example-v2

CSS
70
star
23

awesome-monaco-editor

awesome-monaco-editor
64
star
24

svelte-amplify-datastore-demo

How to do Auth + Amplify Data Store with Svelte
JavaScript
64
star
25

tracking

Developer industry stats and where to find them.
62
star
26

README

a readme for people working with me. always a work in progress.
60
star
27

react-typescript-storybook-starter

react-typescript-storybook-starter
JavaScript
58
star
28

bettertwitter

a better twitter UI
Svelte
56
star
29

egghead-cli-workshop

Build Custom CLI Tooling with OClif and React-Ink!
TypeScript
54
star
30

swyx-react-typescript-snippets

swyx react ts snippets
54
star
31

buying-domains

useful data and advice for buying domains.
44
star
32

codingcareer.com

Career Guides, Principles, Strategies & Tactics to build an exceptional dev career
Svelte
43
star
33

amplify-react-serverless-components

a trial app to deploy React Server Components inside of a serverless AWS Lambda function, scaffolded using the AWS Amplify CLI
CSS
41
star
34

technical-community-builders

companies hiring technical community builders
39
star
35

gatsby-theme-netlify-identity

Add Netlify Identity Authentication to any Gatsby app
JavaScript
38
star
36

hooks

hooks for personal use
TypeScript
38
star
37

rincewind

Rincewind: A boilerplate for React + PostCSS (with Tailwind) + TypeScript
TypeScript
36
star
38

sveltekit-monorepo

sveltekit + turborepo + histoire in a turborepo
JavaScript
36
star
39

digital-garden-tos

Digital Garden Terms of Service
33
star
40

demo-amplify-storage-file-upload

Full Amplify Storage demo showing how to build an app to upload and navigate files in AWS S3
Svelte
33
star
41

company-youtubes

Resource: The Best Company YouTubes
32
star
42

svelte-zen-garden

svelte-zen-garden
CSS
30
star
43

domainblocklist

domains that are mostly just automated reposts of content sites like CSS Tricks
29
star
44

netlify-google-spreadsheet-demo

netlify-google-spreadsheet-demo
JavaScript
28
star
45

podcats

make podcast feeds with markdown, mp3s, and typescript
TypeScript
28
star
46

netlify-plugin-rss

Generate an RSS feed from your static html files, agnostic of static site generator!
HTML
27
star
47

everything-store

Svelte
26
star
48

react-static-podcast-hosting

react-static-podcast-hosting
TypeScript
26
star
49

create-react-app-lambda-typescript

create-react-app-lambda-typescript
TypeScript
26
star
50

alumni-startups

startups by alums of bigname startups
25
star
51

reactive-react

An overly-simplistic mockup of a "Reactive" version of React. See talk slides:
JavaScript
24
star
52

react-blade

Inline GraphQL for the age of Suspense - NO LONGER MAINTAINED
JavaScript
23
star
53

react-wired

wired.js styled components for the discerning react user. not actively developed.
JavaScript
23
star
54

netlify-plugin-no-more-404

Netlify Build plugin to guarantee you preserve your own internal URL structure between builds. Don't break the web! Demo:
JavaScript
22
star
55

async-react-future

high level api's to try with async react
JavaScript
20
star
56

talk-typesafe-fullstack-react-demo-cms

talk-react-summit-demo-cms
TypeScript
20
star
57

smaller-safer-serverless-starter

Build Smaller Safer Serverless web apps faster with Preact, TypeScript, Tailwind, and Next.js
TypeScript
20
star
58

DEPRECATED-netlify-fauna-todo

(DEPRECATED) Netlify Identity + FaunaDB app with most recent versions of FaunaDB client and React
JavaScript
20
star
59

react-todomvc

A simple React component to demo your CRUD backend by implementing just 3 methods!
CSS
19
star
60

podcasting-cheatsheet

tools for podcasting
19
star
61

is-this-netlify

check if a site is hosted on netlify by just prepending "http://is-this.netlify.com"
Svelte
19
star
62

crossbones

Fullstackian award, 1707-FSA-NY. a cross-platform barebones react native setup inspired by https://github.com/FullstackAcademy/bones by
JavaScript
19
star
63

svelte-filesystem-demo

Svelte
18
star
64

bash-cheatsheet

concrete examples of bash syntax for people too lazy to actually learn bash
17
star
65

dev-to-cms

dev-to-cms
TypeScript
17
star
66

gatsby-theme-dev-blog

Swyx's personal opinionated Gatsby Theme for Dev Blogs. See https://swyx.io and see neutral demo at
JavaScript
17
star
67

cli-state

Single, mutable sources of truth for your CLIs
TypeScript
16
star
68

TwoSitesOneRepo

demonstrating how to host multiple sites on netlify from one repo
JavaScript
16
star
69

jamstack-jumpstart

Jamstack-Jumpstart, a workshop for MidDevCon and JSConfAsia 2019
JavaScript
16
star
70

netlify-plugin-encrypted-files

Netlify Build Plugin to obscure files in git repos! (both filenames and their contents) This enables you to partially open source your site, while still being able to work as normal on your local machine and in your Netlify builds.
JavaScript
15
star
71

HNX

swyx's hacker news chrome extension
JavaScript
14
star
72

netlify-fauna-graphql-todo

netlify-fauna-graphql-todo
JavaScript
13
star
73

cli-state-machine

Componentizing and Self-Healing Business Logic with xState Machine
TypeScript
13
star
74

talk-reacts-new-defaults

talk-reacts-new-defaults
JavaScript
12
star
75

blade.macro

this is a placeholder repo speccing out the blade "inline graphql" idea. for a prototype see this site =>
12
star
76

gatsby-plugin-netlify-identity

gatsby-plugin-netlify-identity
JavaScript
11
star
77

FSA-GraphQL-of-Thrones

FSA-GraphQL-of-Thrones
JavaScript
10
star
78

react-static-typescript-starter

react-static-typescript-starter
TypeScript
10
star
79

react-demos

TypeScript
9
star
80

learn-you-a-cloud

learn-you-a-cloud
9
star
81

stateful-serverless

stateful-serverless
JavaScript
9
star
82

gatsby-theme-dev-blog-demo

(DEPRECATED) demo now deploys directly from https://github.com/sw-yx/gatsby-theme-dev-blog
JavaScript
9
star
83

distsys-tldr

TLDRs of Distsys Papers
8
star
84

svelte-cubed-starter

JavaScript
8
star
85

amplify-vscode-snippets

8
star
86

technical-artists

technical-artists
8
star
87

boring-SSG

a proof of concept static site generator with React, Reach Router and Parcel
JavaScript
8
star
88

gatsby-netlify-i18n-redirects

gatsby-netlify-i18n-redirects
CSS
8
star
89

fullstack-serverless-stripe-aws

fullstack-serverless-stripe-aws with Thor & Swyx livestream
JavaScript
8
star
90

react.macro

small babel macros for react
JavaScript
8
star
91

email-tools-list

8
star
92

fresh-react-hooks

DEPRECATED: THIS REPO IS NOT MAINTAINED 😂
8
star
93

react-hero-video

A small styled React component to play your hero videos! Check out the demo:
JavaScript
8
star
94

egghead-storybook2

continuation of my egghead course on storybook
JavaScript
7
star
95

awesometalksdata

data dump from awesometalks.party
JavaScript
7
star
96

rincewind-demo

Rincewind: A boilerplate for React + PostCSS (with Tailwind) + TypeScript
TypeScript
7
star
97

life

The Source Code for Life. A book in progress.
7
star
98

hooks-suspense-faunadb-todo

netlify + faunadb + react hooks
JavaScript
7
star
99

react-static-mdx

react-static-mdx
CSS
7
star
100

AuthApiTesting

Testing Passport.js Authentication gated API routes with Mocha/Chai/Supertest
JavaScript
7
star