Drift is a self-hostable Gist and paste service. Built with Next.js 13 and React Server Components.
See the code
DriftNote: This branch is where all work is being done to refactor to the Next.js 13 app directory and React Server Components.
Drift is a self-hostable Gist clone. It's in beta, but is completely functional.
You can try a demo at https://drift.lol. The demo is built on main but has no database, so files and accounts can be wiped at any time.
If you want to contribute, need support, or want to stay updated, you can join the IRC channel at #drift on irc.libera.chat or reach me on twitter. If you don't have an IRC client yet, you can use a webclient here.
Drift is built with Next.js 13, React Server Components, shadcn/ui, and Prisma.
Contents:
In the root directory, run pnpm i. If you need pnpm, you can download it here.
You can run pnpm dev in client for file watching and live reloading.
To work with prisma, you can use pnpm prisma or pnpm exec prisma to interact with the database.
pnpm build will produce production code. pnpm start will start the Next.js server.
You can change these to your liking.
.env:
DRIFT_URL: the URL of the drift instance.DATABASE_URL: the URL to connect to your postgres instance. For example, postgresql://user:password@localhost:5432/drift.WELCOME_CONTENT: a markdown string that's rendered on the home pageWELCOME_TITLE: the file title for the post on the homepage.ENABLE_ADMIN: the first account created is an administrator accountREGISTRATION_PASSWORD: the password required to register an account. If not set, no password is required.NODE_ENV: defaults to development, can be productionNote: Only credential auth currently supports the registration password, so if you want to secure registration, you must use only credential auth.
GITHUB_CLIENT_ID: the client ID for GitHub OAuth.GITHUB_CLIENT_SECRET: the client secret for GitHub OAuth.NEXTAUTH_URL: the URL of the drift instance. Not required if hosting on Vercel.CREDENTIAL_AUTH: whether to allow username/password authentication. Defaults to true.It's easy to start Drift using pm2.
First, add the .env file with your values (see the above section for the required options).
Then, use the following command to start the server:
pnpm build && pm2 start pnpm --name drift --interpreter bash -- startRefer to pm2's docs or pm2 help for more information.
NOTE: We assume that you know how to enable user lingering if you don't want to use the systemd unit as root
As root
$USERNAME with the shell username of the user that will be running the Drift server##########
# Drift Systemd Unit (Global)
##########
[Unit]
Description=Drift Server (Global)
After=default.target
[Service]
User=$USERNAME
Group=$USERNAME
Type=simple
WorkingDirectory=/home/$USERNAME/Drift
ExecStart=/usr/bin/pnpm start
Restart=on-failure
[Install]
WantedBy=default.target
As a nomal user
$USERNAME with the shell username of the user that will be running the Drift server##########
# Drift Systemd Unit (User)
##########
[Unit]
Description=Drift Server (User)
After=default.target
[Service]
Type=simple
WorkingDirectory=/home/$USERNAME/Drift
ExecStart=/usr/bin/pnpm start
Restart=on-failure
[Install]
WantedBy=default.target
Drift is a work in progress. Below is a (rough) list of completed and envisioned features. If you want to help address any of them, please let me know regardless of your experience and I'll be happy to assist.
app directory(top 24 of 25)
2,102 followers · starred May 2023
614 followers · starred Mar 2022
119 followers · starred Mar 2022
255 followers · starred Sep 2023
Drift is a self-hostable Gist and paste service. Built with Next.js 13 and React Server Components.
See the code
DriftNote: This branch is where all work is being done to refactor to the Next.js 13 app directory and React Server Components.
Drift is a self-hostable Gist clone. It's in beta, but is completely functional.
You can try a demo at https://drift.lol. The demo is built on main but has no database, so files and accounts can be wiped at any time.
If you want to contribute, need support, or want to stay updated, you can join the IRC channel at #drift on irc.libera.chat or reach me on twitter. If you don't have an IRC client yet, you can use a webclient here.
Drift is built with Next.js 13, React Server Components, shadcn/ui, and Prisma.
Contents:
In the root directory, run pnpm i. If you need pnpm, you can download it here.
You can run pnpm dev in client for file watching and live reloading.
To work with prisma, you can use pnpm prisma or pnpm exec prisma to interact with the database.
pnpm build will produce production code. pnpm start will start the Next.js server.
You can change these to your liking.
.env:
DRIFT_URL: the URL of the drift instance.DATABASE_URL: the URL to connect to your postgres instance. For example, postgresql://user:password@localhost:5432/drift.WELCOME_CONTENT: a markdown string that's rendered on the home pageWELCOME_TITLE: the file title for the post on the homepage.ENABLE_ADMIN: the first account created is an administrator accountREGISTRATION_PASSWORD: the password required to register an account. If not set, no password is required.NODE_ENV: defaults to development, can be productionNote: Only credential auth currently supports the registration password, so if you want to secure registration, you must use only credential auth.
GITHUB_CLIENT_ID: the client ID for GitHub OAuth.GITHUB_CLIENT_SECRET: the client secret for GitHub OAuth.NEXTAUTH_URL: the URL of the drift instance. Not required if hosting on Vercel.CREDENTIAL_AUTH: whether to allow username/password authentication. Defaults to true.It's easy to start Drift using pm2.
First, add the .env file with your values (see the above section for the required options).
Then, use the following command to start the server:
pnpm build && pm2 start pnpm --name drift --interpreter bash -- startRefer to pm2's docs or pm2 help for more information.
NOTE: We assume that you know how to enable user lingering if you don't want to use the systemd unit as root
As root
$USERNAME with the shell username of the user that will be running the Drift server##########
# Drift Systemd Unit (Global)
##########
[Unit]
Description=Drift Server (Global)
After=default.target
[Service]
User=$USERNAME
Group=$USERNAME
Type=simple
WorkingDirectory=/home/$USERNAME/Drift
ExecStart=/usr/bin/pnpm start
Restart=on-failure
[Install]
WantedBy=default.target
As a nomal user
$USERNAME with the shell username of the user that will be running the Drift server##########
# Drift Systemd Unit (User)
##########
[Unit]
Description=Drift Server (User)
After=default.target
[Service]
Type=simple
WorkingDirectory=/home/$USERNAME/Drift
ExecStart=/usr/bin/pnpm start
Restart=on-failure
[Install]
WantedBy=default.target
Drift is a work in progress. Below is a (rough) list of completed and envisioned features. If you want to help address any of them, please let me know regardless of your experience and I'll be happy to assist.
app directory(top 24 of 25)
2,102 followers · starred May 2023
614 followers · starred Mar 2022
119 followers · starred Mar 2022
255 followers · starred Sep 2023