Skip to content

Commit

Permalink
♻️ Switch to app router (#922)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukevella authored Nov 6, 2023
1 parent 41f8527 commit 95feb9f
Show file tree
Hide file tree
Showing 181 changed files with 2,523 additions and 2,510 deletions.
11 changes: 11 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# A random 32-character secret key used to encrypt user sessions
SECRET_PASSWORD=abcdef1234567890abcdef1234567890
# The base url where this instance is accessible, including the scheme.
# Example: https://example.com
NEXT_PUBLIC_BASE_URL=http://localhost:3000
NEXTAUTH_URL=$NEXT_PUBLIC_BASE_URL
# A connection string to your Postgres database
DATABASE_URL="postgres://postgres:postgres@localhost:5450/db"

# Suppress warning from sentry during local development
SENTRY_IGNORE_API_RESOLUTION_ERROR=1
25 changes: 0 additions & 25 deletions .eslintrc.json

This file was deleted.

16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
steps:
# Downloads a copy of the code in your repository before running CI tests
- name: Check out repository code
Expand All @@ -56,21 +56,21 @@ jobs:
node-version: 18
cache: yarn

- name: Set environment variables
run: |
echo "DATABASE_URL=postgresql://postgres:password@localhost:5432/rallly" >> $GITHUB_ENV
- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Set environment variables
run: |
echo "DATABASE_URL=postgresql://postgres:password@localhost:5450/db" >> $GITHUB_ENV
- name: Run db
run: |
docker pull postgres:14.2
docker run -d -p 5432:5432 -e POSTGRES_PASSWORD=password -e POSTGRES_DB=rallly postgres:14.2
yarn wait-on --timeout 60000 tcp:localhost:5432
docker run -d -p 5450:5432 -e POSTGRES_PASSWORD=password -e POSTGRES_DB=rallly postgres:14.2
yarn wait-on --timeout 60000 tcp:localhost:5450
- name: Deploy migrations
run: yarn db:deploy
run: yarn db:setup

- name: Install playwright dependencies
run: yarn playwright install --with-deps chromium
Expand Down
62 changes: 35 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,45 +24,53 @@ Built with [Next.js](https://github.com/vercel/next.js/), [Prisma](https://githu

Check out the [self-hosting docs](https://support.rallly.co/self-hosting) for more information on running your own instance of Rallly.

## Development
## Get started

Clone this repo and change directory to the root of the repository.
1. Clone the repository switch to the project directory

```bash
git clone https://github.com/lukevella/rallly.git
cd rallly
```
```bash
git clone https://github.com/lukevella/rallly.git
cd rallly
```

Install dependencies
2. Install dependencies

```
yarn
```
```
yarn
```

Copy the sample `.env` file then open it and set the required [configuration options](https://support.rallly.co/self-hosting/configuration-options).
3. Setup environment variables

```bash
cp sample.env .env
```
```bash
cp sample.env .env
```

Next, run the following command:
Create a `.env` file by copying `sample.env` then open it and set the required [configuration options](https://support.rallly.co/self-hosting/configuration-options).

```
yarn db:generate && yarn db:reset
```
4. Setup the database

This will:
If you don't have a postgres database running locally, you can spin up a new database using docker by running:

- generate the prisma database client
- run migrations to create the database schema
- seed the database with some random data
```
yarn dx
```

Start the Next.js server
If you already have a postgres database, you can run the migrations and seed the database by running:

```
# For development
yarn dev
```
```
yarn db:setup
```

This will:

- run migrations to create the database schema
- seed the database with test users and random data

5. Start the Next.js server

```
yarn dev
```

## Contributors

Expand Down
4 changes: 4 additions & 0 deletions apps/docs/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
...require("@rallly/eslint-config")(__dirname),
};
5 changes: 4 additions & 1 deletion apps/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"name": "@rallly/docs",
"version": "0.0.0",
"private": true
"private": true,
"devDependencies": {
"@rallly/tsconfig": "*"
}
}
5 changes: 5 additions & 0 deletions apps/docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "@rallly/tsconfig/next.json",
"include": ["**/*.ts", "**/*.tsx", "**/*.js"],
"exclude": ["node_modules"]
}
4 changes: 4 additions & 0 deletions apps/landing/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
...require("@rallly/eslint-config")(__dirname),
};
8 changes: 0 additions & 8 deletions apps/landing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"@svgr/webpack": "^6.5.1",
"@tailwindcss/typography": "^0.5.9",
"@vercel/analytics": "^0.1.8",
"@vercel/og": "^0.5.11",
"autoprefixer": "^10.4.13",
"class-variance-authority": "^0.6.0",
"dayjs": "^1.11.7",
Expand Down Expand Up @@ -50,15 +49,8 @@
"@types/smoothscroll-polyfill": "^0.3.1",
"cheerio": "^1.0.0-rc.12",
"cross-env": "^7.0.3",
"eslint-config-turbo": "^0.0.9",
"eslint-import-resolver-typescript": "^2.7.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"i18next-scanner": "^4.2.0",
"i18next-scanner-typescript": "^1.1.1",
"prettier-plugin-tailwindcss": "^0.1.8",
"smtp-tester": "^2.0.1",
"wait-on": "^6.0.1"
}
Expand Down
2 changes: 1 addition & 1 deletion apps/landing/src/components/error-page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FrownIcon } from "@rallly/icons";
import { FrownIcon } from "lucide-react";
import Head from "next/head";
import Link from "next/link";
import { useTranslation } from "next-i18next";
Expand Down
6 changes: 3 additions & 3 deletions apps/landing/src/components/home/bonus.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { cn } from "@rallly/ui";
import { m } from "framer-motion";
import {
CalendarCheck2Icon,
LanguagesIcon,
Users2Icon,
ZapIcon,
} from "@rallly/icons";
import { cn } from "@rallly/ui";
import { m } from "framer-motion";
} from "lucide-react";

import { Trans } from "@/components/trans";
import { IconComponent } from "@/types";
Expand Down
2 changes: 1 addition & 1 deletion apps/landing/src/components/home/color-hash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function isBright(color: RGBColor): boolean {
export const getRandomAvatarColor = (str: string) => {
const strSum = str.split("").reduce((acc, val) => acc + val.charCodeAt(0), 0);
const randomIndex = strSum % avatarBackgroundColors.length;
const color = avatarBackgroundColors[randomIndex];
const color = avatarBackgroundColors[randomIndex] as RGBColor;
const [r, g, b] = color;
return { color: `rgb(${r}, ${g}, ${b})`, requiresDarkText: isBright(color) };
};
Expand Down
2 changes: 1 addition & 1 deletion apps/landing/src/components/home/hero.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ChevronRightIcon } from "@rallly/icons";
import { Badge } from "@rallly/ui/badge";
import { Button } from "@rallly/ui/button";
import { preventWidows } from "@rallly/utils";
import { m } from "framer-motion";
import { ChevronRightIcon } from "lucide-react";
import Image from "next/image";
import Link from "next/link";
import * as React from "react";
Expand Down
2 changes: 1 addition & 1 deletion apps/landing/src/components/layouts/blog-layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NewspaperIcon } from "@rallly/icons";
import { NewspaperIcon } from "lucide-react";
import Script from "next/script";

import PageLayout from "@/components/layouts/page-layout";
Expand Down
2 changes: 1 addition & 1 deletion apps/landing/src/components/layouts/page-layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { ChevronRightIcon, MenuIcon } from "@rallly/icons";
import { cn } from "@rallly/ui";
import {
DropdownMenu,
Expand All @@ -7,6 +6,7 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@rallly/ui/dropdown-menu";
import { ChevronRightIcon, MenuIcon } from "lucide-react";
import Image from "next/image";
import Link from "next/link";
import { useRouter } from "next/router";
Expand Down
14 changes: 7 additions & 7 deletions apps/landing/src/components/layouts/page-layout/footer.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
DiscordIcon,
GithubIcon,
LanguagesIcon,
LinkedinIcon,
TwitterIcon,
} from "@rallly/icons";
import { DiscordIcon } from "@rallly/icons";
import languages from "@rallly/languages";
import {
Select,
Expand All @@ -13,6 +7,12 @@ import {
SelectTrigger,
SelectValue,
} from "@rallly/ui/select";
import {
GithubIcon,
LanguagesIcon,
LinkedinIcon,
TwitterIcon,
} from "lucide-react";
import Image from "next/image";
import Link from "next/link";
import { useRouter } from "next/router";
Expand Down
2 changes: 1 addition & 1 deletion apps/landing/src/components/marketing.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ArrowUpRight } from "@rallly/icons";
import { m } from "framer-motion";
import { ArrowUpRight } from "lucide-react";
import Image from "next/image";
import Link from "next/link";
import { NextSeo } from "next-seo";
Expand Down
2 changes: 1 addition & 1 deletion apps/landing/src/pages/404.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FileSearchIcon } from "@rallly/icons";
import { FileSearchIcon } from "lucide-react";
import { GetStaticProps } from "next";
import { useTranslation } from "next-i18next";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
Expand Down
2 changes: 1 addition & 1 deletion apps/landing/src/pages/api/og-image.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable @next/next/no-img-element */
import { ImageResponse } from "@vercel/og";
import { ImageResponse } from "next/og";
import { NextRequest } from "next/server";

export const config = {
Expand Down
4 changes: 3 additions & 1 deletion apps/landing/src/pages/blog/[slug].tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ArrowLeftIcon } from "@rallly/icons";
import { ArrowLeftIcon } from "lucide-react";
import { GetStaticPropsContext } from "next";
import ErrorPage from "next/error";
import Head from "next/head";
Expand Down Expand Up @@ -117,6 +117,8 @@ export async function getStaticProps(ctx: GetStaticPropsContext) {
},
};
}

return res;
}

export async function getStaticPaths() {
Expand Down
2 changes: 1 addition & 1 deletion apps/landing/src/pages/pricing.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { TrendingUpIcon } from "@rallly/icons";
import {
BillingPlan,
BillingPlanDescription,
Expand All @@ -11,6 +10,7 @@ import {
} from "@rallly/ui/billing-plan";
import { Button } from "@rallly/ui/button";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@rallly/ui/tabs";
import { TrendingUpIcon } from "lucide-react";
import Link from "next/link";
import { useTranslation } from "next-i18next";
import { NextSeo } from "next-seo";
Expand Down
19 changes: 4 additions & 15 deletions apps/landing/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
{
"extends": "@rallly/tsconfig/next.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/*"],
"~/*": ["public/*"]
},
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
"checkJs": false
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "next-i18next.config.js"],
"exclude": ["node_modules", "**/*.js"]
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
4 changes: 2 additions & 2 deletions .env.test → apps/web/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ PORT=3002
NEXT_PUBLIC_BASE_URL=http://localhost:3002
NEXTAUTH_URL=http://localhost:3002
SECRET_PASSWORD=abcdefghijklmnopqrstuvwxyz1234567890
DATABASE_URL=postgres://postgres:postgres@localhost:5432/rallly
SUPPORT_EMAIL=support@rallly.co
DATABASE_URL=postgres://postgres:postgres@localhost:5450/db
SUPPORT_EMAIL=support@rallly.co
4 changes: 4 additions & 0 deletions apps/web/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
...require("@rallly/eslint-config")(__dirname),
};
2 changes: 1 addition & 1 deletion apps/web/declarations/i18next.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "react-i18next";
import "i18next";

import app from "../public/locales/en/app.json";

Expand Down
1 change: 1 addition & 0 deletions apps/web/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
Loading

2 comments on commit 95feb9f

@vercel
Copy link

@vercel vercel bot commented on 95feb9f Nov 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 95feb9f Nov 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

app – ./

app-rallly.vercel.app
app-git-main-rallly.vercel.app
rallly-vert.vercel.app
app.rallly.co

Please sign in to comment.