Skip to content

Commit

Permalink
chore: change name to insights
Browse files Browse the repository at this point in the history
  • Loading branch information
giu7d committed May 27, 2024
1 parent e4b0c16 commit f2352d2
Show file tree
Hide file tree
Showing 33 changed files with 80 additions and 276 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ SUPERTOKENS_WEB_DOMAIN_URI='http://localhost:4000'
#
DB_HOST='localhost'
DB_PORT='5432'
DB_NAME='splitter_dev'
DB_NAME='insights_dev'
DB_USERNAME='postgres'
DB_PASSWORD='postgres'
# only for auth
DB_AUTH_NAME='splitter_auth_dev'
DB_AUTH_NAME='insights_auth_dev'
198 changes: 2 additions & 196 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,197 +1,3 @@
# Splitter
# Insights

![Splitter Logo](docs/images/logo.png)

> Expo + Turborepo + tRPC go brrrrrrr 🚀🔥
## Summary

1. [Usage](#usage)

1.1 [Development](#development)

1.2 [Production](#production)

1.3 [Test](#test)

2. [Deploy](#deploy)

3. [Screen Shots](#screen-shots)

4. [Motivation](#motivation)

5. [Stack](#stack)

## Usage

### Development

Setup development environment With Turbo repo.

1. 🏗 Setup `.env` files:

```bash
cp .env.example .env
```

2. 📦 Install dependencies, _inside the root folder run_:

```bash
pnpm install
```

3. 🚀 Run in development mode, _inside the root folder run_:

```bash
pnpm run dev
```

### Production

For every app, but mobile the process is really straightforward:

1. 🏗 Setup `.env` files:

```bash
cp .env.example .env
```

2. 📦 Install dependencies, _inside the root folder run_:

```bash
pnpm install
```

3. 📦 Build all apps packages, _inside the root folder run_:

```bash
pnpm run build
```

3. 🚀 Run the production builds, _inside the root folder run_:

```bash
pnpm run start
```

#### Mobile (.APK, .IPA)

If you want a preview of the mobile app, in a apk or ipa, you will have to:

```bash
cd apps/mobile

eas build -p android --profile development
```

### Test

#### Lint

```bash
pnpm run lint
```

This lints stuff...

If you want to test specifics run _inside each app folder_.

#### Unit and Integration

To run unit and integration tests just run this shit locally:

```bash
pnpm run test
```

It will test every repo, if you want to test specifics run _inside each app folder_.

#### End To End

End to end test is handled by **detox**, to run the test first we need to build an release app.

Inside `apps/mobile` folder run:

```bash
# ios
pnpm run e2e:ios:build
# or
# android
pnpm run e2e:android:build
```

Next, run the detox test script:

```bash
# ios
pnpm run e2e:ios:test
# or
# android
pnpm run e2e:android:test
```

Both tests will be run in `headless` mode, so don't expect the emulator to pop-up.

## Deploy

We are using **railway.app** to deploy the backend app, and **EAS** to build, update, and release the mobile app.

## Screen Shots


https://github.com/giu7d/splitter/assets/30274817/fd2df51b-852d-49ae-87c3-5d9c57cd3f3f

## Motivation

This study objective is not to create an application restricted in a stack. But to elaborate and test SOTA tools that enable a stable and productive stack.
Or goals with the final product is to find a stack that:

1. Improves developer experience;
2. Allows fast deploy and development;
3. Constructs an app with great performance;
4. Defines an architecture to easily componentize and reuse animations;
5. Implements code quality tools (e.g. test, static analysis, linting, etc.);
6. Target the largest number of devices (e.g. ios, android, and web).

## Stack

Current stack been used in the challenge:

**Workspace**

- [x] pnpm
- [x] turborepo

**Framework**

- [x] react native
- [x] expo

**Test & Debug**

- [x] flipper
- [x] detox
- [x] jest

**Components, Animation & Styling**

- [x] nativewind (Tailwind)
- [x] reanimated
- [x] flash list - [docs](https://github.com/shopify/flash-list)

**State Management & Storage**

- [x] jotai - [docs](https://jotai.org/)
- [x] MMKV - [docs](https://github.com/mrousavy/react-native-mmkv)

**Network & API**

- [x] react query
- [x] tRPC - [docs](https://trpc.io/)
- [x] fastify - [docs](https://www.fastify.io/)

**Deploy**

- [x] github actions
- [x] railway.app
- [x] eas
TO DO
8 changes: 4 additions & 4 deletions apps/api/esbuild.config.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import esbuild from 'esbuild'

import authPackage from '@splitter/package-auth/package.json' assert { type: 'json' }
import dbPackage from '@splitter/package-db/package.json' assert { type: 'json' }
import validatorsPackage from '@splitter/package-validators/package.json' assert { type: 'json' }
import authPackage from '@insights/package-auth/package.json' assert { type: 'json' }
import dbPackage from '@insights/package-db/package.json' assert { type: 'json' }
import validatorsPackage from '@insights/package-validators/package.json' assert { type: 'json' }

import apiPackage from './package.json' assert { type: 'json' }

Expand All @@ -16,7 +16,7 @@ function getDependencies(pkg) {
function getExternalDependencies(packages = []) {
return packages
.flatMap((pkg) => getDependencies(pkg))
.filter((dep) => !dep.startsWith('@splitter'))
.filter((dep) => !dep.startsWith('@insights'))
}

export default esbuild.build({
Expand Down
2 changes: 1 addition & 1 deletion apps/api/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import config from '@splitter/tooling-eslint/base'
import config from '@insights/tooling-eslint/base'

/** @type {import('typescript-eslint').Config} */
export default [
Expand Down
18 changes: 9 additions & 9 deletions apps/api/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@splitter/api",
"name": "@insights/api",
"version": "1.0.0",
"main": "build/index.mjs",
"private": true,
Expand Down Expand Up @@ -30,9 +30,9 @@
"@fastify/compress": "^7.0.3",
"@fastify/cors": "^8.5.0",
"@fastify/formbody": "^7.4.0",
"@splitter/package-auth": "workspace:*",
"@splitter/package-db": "workspace:*",
"@splitter/package-validators": "workspace:*",
"@insights/package-auth": "workspace:*",
"@insights/package-db": "workspace:*",
"@insights/package-validators": "workspace:*",
"@t3-oss/env-core": "^0.10.1",
"@trpc/server": "^10.45.2",
"colors": "^1.4.0",
Expand All @@ -41,10 +41,10 @@
"zod": "^3.23.4"
},
"devDependencies": {
"@splitter/package-validators": "workspace:*",
"@splitter/tooling-eslint": "workspace:*",
"@splitter/tooling-prettier": "workspace:*",
"@splitter/tooling-typescript": "workspace:*",
"@insights/package-validators": "workspace:*",
"@insights/tooling-eslint": "workspace:*",
"@insights/tooling-prettier": "workspace:*",
"@insights/tooling-typescript": "workspace:*",
"@types/jest": "^29.5.12",
"@types/node": "^18.19.31",
"@vercel/node": "^2.15.10",
Expand All @@ -59,5 +59,5 @@
"typescript": "^5.4.5",
"wait-on": "^7.2.0"
},
"prettier": "@splitter/tooling-prettier"
"prettier": "@insights/tooling-prettier"
}
3 changes: 1 addition & 2 deletions apps/api/src/env.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import authEnv from '@insights/package-auth/env'
import { createEnv } from '@t3-oss/env-core'
import { z } from 'zod'

import authEnv from '@splitter/package-auth/env'

export default createEnv({
extends: [authEnv],
server: {
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/web/endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
authCorsHeaders,
authErrorHandler,
authPlugin,
} from '@splitter/package-auth'
} from '@insights/package-auth'

import router from '@/web/router'
import { createContext } from '@/web/trpc'
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/web/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
CreateUserSchema,
FindBillsSchema,
FindUserSchema,
} from '@splitter/package-validators'
} from '@insights/package-validators'

import Bills from '@/use-cases/bills'
import Users from '@/use-cases/users'
Expand Down
3 changes: 1 addition & 2 deletions apps/api/src/web/trpc.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import type { CreateFastifyContextOptions } from '@trpc/server/adapters/fastify'

import { authSession } from '@insights/package-auth'
import { TRPCError, initTRPC } from '@trpc/server'
import superjson from 'superjson'
import { ZodError } from 'zod'

import { authSession } from '@splitter/package-auth'

export const createContext = (ctx: CreateFastifyContextOptions) => ctx

const t = initTRPC.context<typeof createContext>().create({
Expand Down
2 changes: 1 addition & 1 deletion apps/api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@splitter/tooling-typescript/base.json",
"extends": "@insights/tooling-typescript/base.json",
"compilerOptions": {
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json",
"outDir": "build",
Expand Down
12 changes: 6 additions & 6 deletions apps/mobile/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ function isProductionEnv() {
}

function getName() {
if (isProductionEnv()) return 'Splitter'
return `Splitter (${ENV})`
if (isProductionEnv()) return 'insights'
return `insights (${ENV})`
}

function getBundleIdentifier() {
if (isProductionEnv()) return 'com.prisma.splitter'
return `com.prisma.splitter.${ENV.toLowerCase()}`
if (isProductionEnv()) return 'com.prisma.insights'
return `com.prisma.insights.${ENV.toLowerCase()}`
}

export default ({ config }: ConfigContext): ExpoConfig => ({
...config,
//
// App Information
name: getName(),
slug: 'splitter',
scheme: 'splitter',
slug: 'insights',
scheme: 'insights',
version: '1.0.0',
owner: 'giu7d',
//
Expand Down
4 changes: 2 additions & 2 deletions apps/mobile/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import baseConfig from '@splitter/tooling-eslint/base'
import reactConfig from '@splitter/tooling-eslint/react'
import baseConfig from '@insights/tooling-eslint/base'
import reactConfig from '@insights/tooling-eslint/react'

/** @type {import('typescript-eslint').Config} */
export default [
Expand Down
14 changes: 7 additions & 7 deletions apps/mobile/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@splitter/mobile",
"name": "@insights/mobile",
"main": "expo-router/entry",
"version": "1.0.0",
"private": true,
Expand Down Expand Up @@ -50,11 +50,11 @@
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@splitter/api": "workspace:*",
"@splitter/package-validators": "workspace:*",
"@splitter/tooling-eslint": "workspace:*",
"@splitter/tooling-prettier": "workspace:*",
"@splitter/tooling-typescript": "workspace:*",
"@insights/api": "workspace:*",
"@insights/package-validators": "workspace:*",
"@insights/tooling-eslint": "workspace:*",
"@insights/tooling-prettier": "workspace:*",
"@insights/tooling-typescript": "workspace:*",
"@types/jest": "^29.5.12",
"@types/react": "~18.2.45",
"@types/react-test-renderer": "^18.0.7",
Expand All @@ -69,5 +69,5 @@
"jest": {
"preset": "jest-expo"
},
"prettier": "@splitter/tooling-prettier"
"prettier": "@insights/tooling-prettier"
}
Loading

0 comments on commit f2352d2

Please sign in to comment.