Skip to content

Commit

Permalink
Banking App
Browse files Browse the repository at this point in the history
  • Loading branch information
divya-jeevanantham committed Sep 17, 2024
0 parents commit 86863ee
Show file tree
Hide file tree
Showing 107 changed files with 11,720 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#NEXT
NEXT_PUBLIC_SITE_URL=http://localhost:3000

#APPWRITE
NEXT_PUBLIC_APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1
NEXT_PUBLIC_APPWRITE_PROJECT=
APPWRITE_DATABASE_ID=
APPWRITE_USER_COLLECTION_ID=
APPWRITE_ITEM_COLLECTION_ID=
APPWRITE_BANK_COLLECTION_ID=
APPWRITE_TRANSACTION_COLLECTION_ID=
NEXT_APPWRITE_KEY=

#PLAID
PLAID_CLIENT_ID=
PLAID_SECRET=
PLAID_ENV=
PLAID_PRODUCTS=
PLAID_COUNTRY_CODES=

#DWOLLA
DWOLLA_KEY=
DWOLLA_SECRET=
DWOLLA_BASE_URL=
DWOLLA_ENV=
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

# Sentry Config File
.sentryclirc

# Environment file
.env
32 changes: 32 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Next.js: debug server-side",
"type": "node-terminal",
"request": "launch",
"command": "npm run dev"
},
{
"name": "Next.js: debug client-side",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000"
},
{
"name": "Next.js: debug full stack",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/next",
"runtimeArgs": ["--inspect"],
"skipFiles": ["<node_internals>/**"],
"serverReadyAction": {
"action": "debugWithChrome",
"killOnServerStop": true,
"pattern": "- Local:.+(https?://.+)",
"uriFormat": "%s",
"webRoot": "${workspaceFolder}"
}
}
]
}
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
24 changes: 24 additions & 0 deletions app/(auth)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import Image from "next/image";

export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<main className="flex min-h-screen w-full justify-between font-inter">
{children}
<div className="auth-asset">
<div>
<Image
src="/icons/auth-image.svg"
alt="Auth image"
width={500}
height={500}
className="rounded-l-xl object-contain"
/>
</div>
</div>
</main>
);
}
11 changes: 11 additions & 0 deletions app/(auth)/sign-in/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import AuthForm from '@/components/AuthForm'

const SignIn = () => {
return (
<section className="flex-center size-full max-sm:px-6">
<AuthForm type="sign-in" />
</section>
)
}

export default SignIn
11 changes: 11 additions & 0 deletions app/(auth)/sign-up/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import AuthForm from '@/components/AuthForm'

const SignUp = async () => {
return (
<section className="flex-center size-full max-sm:px-6">
<AuthForm type="sign-up" />
</section>
)
}

export default SignUp
31 changes: 31 additions & 0 deletions app/(root)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import MobileNav from "@/components/MobileNav";
import Sidebar from "@/components/Sidebar";
import { getLoggedInUser } from "@/lib/actions/user.actions";
import Image from "next/image";
import { redirect } from "next/navigation";

export default async function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
const loggedIn = await getLoggedInUser();

if(!loggedIn) redirect('/sign-in')

return (
<main className="flex h-screen w-full font-inter">
<Sidebar user={loggedIn} />

<div className="flex size-full flex-col">
<div className="root-layout">
<Image src="/icons/logo.svg" width={30} height={30} alt="logo" />
<div>
<MobileNav user={loggedIn} />
</div>
</div>
{children}
</div>
</main>
);
}
40 changes: 40 additions & 0 deletions app/(root)/my-banks/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import BankCard from '@/components/BankCard';
import HeaderBox from '@/components/HeaderBox'
import { getAccounts } from '@/lib/actions/bank.actions';
import { getLoggedInUser } from '@/lib/actions/user.actions';
import React from 'react'

const MyBanks = async () => {
const loggedIn = await getLoggedInUser();
const accounts = await getAccounts({
userId: loggedIn.$id
})

return (
<section className='flex'>
<div className="my-banks">
<HeaderBox
title="My Bank Accounts"
subtext="Effortlessly manage your banking activities."
/>

<div className="space-y-4">
<h2 className="header-2">
Your cards
</h2>
<div className="flex flex-wrap gap-6">
{accounts && accounts.data.map((a: Account) => (
<BankCard
key={accounts.id}
account={a}
userName={loggedIn?.firstName}
/>
))}
</div>
</div>
</div>
</section>
)
}

export default MyBanks
57 changes: 57 additions & 0 deletions app/(root)/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import HeaderBox from '@/components/HeaderBox'
import RecentTransactions from '@/components/RecentTransactions';
import RightSidebar from '@/components/RightSidebar';
import TotalBalanceBox from '@/components/TotalBalanceBox';
import { getAccount, getAccounts } from '@/lib/actions/bank.actions';
import { getLoggedInUser } from '@/lib/actions/user.actions';

const Home = async ({ searchParams: { id, page } }: SearchParamProps) => {
const currentPage = Number(page as string) || 1;
const loggedIn = await getLoggedInUser();
const accounts = await getAccounts({
userId: loggedIn?.$id
})

if(!accounts) return;

const accountsData = accounts?.data;
const appwriteItemId = (id as string) || accountsData[0]?.appwriteItemId;

const account = await getAccount({ appwriteItemId })

return (
<section className="home">
<div className="home-content">
<header className="home-header">
<HeaderBox
type="greeting"
title="Welcome"
user={loggedIn?.firstName || 'Guest'}
subtext="Access and manage your account and transactions efficiently."
/>

<TotalBalanceBox
accounts={accountsData}
totalBanks={accounts?.totalBanks}
totalCurrentBalance={accounts?.totalCurrentBalance}
/>
</header>

<RecentTransactions
accounts={accountsData}
transactions={account?.transactions}
appwriteItemId={appwriteItemId}
page={currentPage}
/>
</div>

<RightSidebar
user={loggedIn}
transactions={account?.transactions}
banks={accountsData?.slice(0, 2)}
/>
</section>
)
}

export default Home
31 changes: 31 additions & 0 deletions app/(root)/payment-transfer/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import HeaderBox from '@/components/HeaderBox'
import PaymentTransferForm from '@/components/PaymentTransferForm'
import { getAccounts } from '@/lib/actions/bank.actions';
import { getLoggedInUser } from '@/lib/actions/user.actions';
import React from 'react'

const Transfer = async () => {
const loggedIn = await getLoggedInUser();
const accounts = await getAccounts({
userId: loggedIn.$id
})

if(!accounts) return;

const accountsData = accounts?.data;

return (
<section className="payment-transfer">
<HeaderBox
title="Payment Transfer"
subtext="Please provide any specific details or notes related to the payment transfer"
/>

<section className="size-full pt-5">
<PaymentTransferForm accounts={accountsData} />
</section>
</section>
)
}

export default Transfer
Loading

0 comments on commit 86863ee

Please sign in to comment.