Skip to content

Commit

Permalink
Migrate to biome 🔼
Browse files Browse the repository at this point in the history
  • Loading branch information
radityaharya committed Apr 23, 2024
1 parent 7d932fb commit 55f52df
Show file tree
Hide file tree
Showing 98 changed files with 754 additions and 579 deletions.
41 changes: 25 additions & 16 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
# Since the ".env" file is gitignored, you can use the ".env.example" file to
# build a new ".env" file when you clone the repo. Keep this file up-to-date
# when you add new variables to `.env`.

# This file will be committed to version control, so make sure not to have any
# secrets in it. If you are cloning this repo, create a copy of this file named
# ".env" and populate it with your secrets.

# When adding additional environment variables, the schema in "/src/env.js"
# should be updated accordingly.

# Drizzle
# Get the Database URL from the "prisma" dropdown selector in PlanetScale.
# Change the query params at the end of the URL to "?ssl={"rejectUnauthorized":true}"
DATABASE_URL='mysql://YOUR_MYSQL_URL_HERE?ssl={"rejectUnauthorized":true}'
# Database
DATABASE_URL='postgresql://postgres:postgres@postgres:5432/flowify-development'

# Next Auth
# You can generate a new secret on the command line with:
# openssl rand -base64 32
# https://next-auth.js.org/configuration/options#secret
# NEXTAUTH_SECRET=""
NEXTAUTH_SECRET=""
NEXTAUTH_URL="http://localhost:3000"

# Next Auth Discord Provider
# Next Auth Spotify Provider
SPOTIFY_CLIENT_ID=""
SPOTIFY_CLIENT_SECRET=""

# Redis
REDIS_URL="redis://redis:6379"


# Development

# Skips environment validation in ~/src/env.js Used for builds
#SKIP_ENV_VALIDATION=true

# Disables workflow instrumentation
#NO_WORKER=true

#CONFIGS

# Sentry
#SENTRY=true

# MILLION


24 changes: 11 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Overview

Flowify is a powerful workflow builder designed to simplify complex Spotify playlist generation. By Using [React Flow](https://reactflow.dev/) as the workflow builder, [bull-mq](https://github.com/taskforcesh/bullmq) for queuing, [shadcn/ui](https://ui.shadcn.com/) for components, [Drizzle](https://orm.drizzle.team/) as ORM, and [Planetscale](https://planetscale.com/) for the database.
Flowify is a drag-and-drop environment for creating Spotify playlist generation workflows. With Flowify, you can create custom workflows to generate playlists based on your Spotify library, liked tracks, and recommendations. Flowify is built with [React Flow](https://reactflow.dev/) as the workflow builder, [bull-mq](https://github.com/taskforcesh/bullmq) for queuing, [shadcn/ui](https://ui.shadcn.com/) for components, [Drizzle](https://orm.drizzle.team/) as ORM

Flowify is heavily inspired by [SmarterPlaylists](https://github.com/plamere/SmarterPlaylists) and [Goofy](https://github.com/Chimildic/goofy). Flowify aims to provide a modern and intuitive alternative to SmarterPlaylists, while also providing a more flexible and powerful alternative to Goofy.

Expand Down Expand Up @@ -84,25 +84,23 @@ To get started with Flowify, follow these steps:
Start a Redis server. You can download and install Redis from the [official website](https://redis.io/). Alternatively, you can use a cloud service such as [Railway](https://docs.railway.app/guides/redis) or [Upstash](https://upstash.com/). Redis is used for queueing and caching.

3. **Set Up Database:**
Create a database on [Planetscale](https://planetscale.com/) and create a connection string. You can find instructions on how to do this [here](https://planetscale.com/docs/tutorials/connect-nextjs-app#generate-a-connection-string).
Create a Postgres database and set the `DATABASE_URL` environment variable. You can use a local Postgres instance or a cloud service such as [Neon](https://neon.tech/). Flowify uses [Drizzle](https://orm.drizzle.team/) as the ORM.

4. **Set Up Spotify API:**
Create a Spotify developer account and create a new application. You can find instructions on how to do this [here](https://developer.spotify.com/documentation/web-api/concepts/apps). Keep the client ID and client secret handy.

5. **Set Up Environment Variables:**
Create a `.env` file in the root directory and add the following variables:

| Variable | Description |
| --------------------- | -------------------------------- |
| DATABASE_URL | Planetscale DB connection string |
| NEXTAUTH_SECRET | NextAuth secret key |
| NEXTAUTH_URL | NextAuth application URL |
| SPOTIFY_CLIENT_ID | Spotify API client ID |
| SPOTIFY_CLIENT_SECRET | Spotify API client secret |
| REDIS_URL | Redis connection URL |
| IMGPROXY_KEY | Imgproxy encryption key |
| IMGPROXY_SALT | Imgproxy encryption salt |
| IMGPROXY_URL | Imgproxy URL |
| Variable | Description |
| --------------------- | -----------------------------------|
| DATABASE_URL | Postgres connection string |
| NEXTAUTH_SECRET | NextAuth secret key |
| NEXTAUTH_URL | NextAuth application URL |
| SPOTIFY_CLIENT_ID | Spotify API client ID |
| SPOTIFY_CLIENT_SECRET | Spotify API client secret |
| REDIS_URL | Redis connection URL |
| NO_WORKER | Disables built-in workflow runner |

6. **Push the schema to your database:**

Expand Down
66 changes: 66 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"$schema": "https://biomejs.dev/schemas/1.6.1/schema.json",
"vcs": { "clientKind": "git", "enabled": true },
"files": {
"ignore": [
"next.config.js",
"node_modules/**/*",
"dist/**/*",
".next/**/*",
"*.json"
]
},
"formatter": {
"enabled": true,
"formatWithErrors": false,
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 80,
"attributePosition": "auto"
},
"organizeImports": { "enabled": true },
"linter": {
"enabled": true,
"rules": {
"all": true,
"a11y": { "noSvgWithoutTitle": "off" },
"complexity": {
"noForEach": "off",
"noBannedTypes": "warn",
"noStaticOnlyClass": "off"
},
"nursery": {
"noNodejsModules": "off",
"noUndeclaredDependencies": "off",
"useImportRestrictions": "off",
"useSortedClasses": "off"
},
"style": { "all": false },
"suspicious": {
"noExplicitAny": "off",
"noShadowRestrictedNames": "off",
"noPrototypeBuiltins": "off",
"noImplicitAnyLet": "off",
"noArrayIndexKey": "warn",
"noAssignInExpressions": "off"
}, "correctness": {
"noUndeclaredVariables": "off"
}
}
},
"javascript": {
"formatter": {
"jsxQuoteStyle": "double",
"quoteProperties": "asNeeded",
"trailingComma": "all",
"semicolons": "always",
"arrowParentheses": "always",
"bracketSpacing": true,
"bracketSameLine": false,
"quoteStyle": "double",
"attributePosition": "auto"
}
},
"json": { "parser": { "allowComments": true } }
}
3 changes: 3 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ const config = {
experimental: {
instrumentationHook: process.env.NO_WORKER ? false : true,
},
eslint: {
ignoreDuringBuilds: true,
},
output: process.env.STANDALONE_OUTPUT ? "standalone" : undefined,
images: {
remotePatterns: [
Expand Down
156 changes: 156 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
"dev": "next dev",
"dev:turbo": "next dev --turbo",
"bun:dev": "bun --bun next dev",
"lint": "next lint",
"format": "prettier --write .",
"lint": "biome lint . --diagnostic-level=error",
"lint:next": "next lint",
"format": "biome format --changed --write .",
"check": "biome check --apply ./src",
"start": "next start",
"start:worker": "dotenv -e .env bun ./worker/worker.ts",
"dev:worker": "bun run --watch ./worker/worker.ts"
Expand Down Expand Up @@ -80,6 +82,7 @@
"zustand": "^4.5.2"
},
"devDependencies": {
"@biomejs/biome": "1.7.1",
"@next/eslint-plugin-next": "^14.2.2",
"@types/eslint": "^8.56.9",
"@types/node": "^20.12.7",
Expand Down
6 changes: 3 additions & 3 deletions src/app/api/user/[uid]/playlist/[playlistId]/route.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { NextResponse, type NextRequest } from "next/server";
import { getAccessTokenFromProviderAccountId } from "~/server/db/helper";
import { type NextRequest, NextResponse } from "next/server";
import SpotifyWebApi from "spotify-web-api-node";
import { env } from "~/env";
import { getAccessTokenFromProviderAccountId } from "~/server/db/helper";
export async function GET(
request: NextRequest,
_request: NextRequest,
{
params,
}: {
Expand Down
4 changes: 2 additions & 2 deletions src/app/api/user/[uid]/playlists/route.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NextResponse, type NextRequest } from "next/server";
import { getAccessTokenFromProviderAccountId } from "~/server/db/helper";
import { type NextRequest, NextResponse } from "next/server";
import SpotifyWebApi from "spotify-web-api-node";
import { env } from "~/env";
import { getAccessTokenFromProviderAccountId } from "~/server/db/helper";
export async function GET(
request: NextRequest,
{
Expand Down
6 changes: 3 additions & 3 deletions src/app/api/user/[uid]/workflows/route.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { NextResponse, type NextRequest } from "next/server";
import { getServerSession } from "next-auth";
import { Logger } from "@/lib/log";
import { authOptions } from "@/server/auth";
import { db } from "@/server/db";
import { Logger } from "@/lib/log";
import { getServerSession } from "next-auth";
import { type NextRequest, NextResponse } from "next/server";

const log = new Logger("/api/workflow/[id]");

Expand Down
Loading

0 comments on commit 55f52df

Please sign in to comment.