Skip to content

Tincre/investor.tincre.com

Repository files navigation

Tincre Investor Relations

Tincre Corporate Logo

A simple Single Page App for getting Tincre funded. Hit it: investor.tincre.com.

Built on Next.js, styled with Tailwindcss, and deployed on Vercel.

Development and support provided by Phund, by Tincre.

Features

Development Setup

Clone this repo. Then,

yarn install
yarn run dev

🚀 The dev site will be running locally at localhost:3000 🚀.

Environment

You'll need some credentials to get up and running properly.

Create a .env file in the same directory as your package.json, as follows.

DATABASE_URL="postgresql://<your-connection-info>"
SHADOW_DATABASE_URL="postgresql://<your-shadow-connection-info"
CHECKPOINT_DISABLE=1
SIGNING_PASSPHRASE="<a-generated-passphrase>"
NEXTAUTH_SECRET="<a-generated-passphrase>"
EMAIL_API_KEY="<SG.your-sendgrid-key>"
EMAIL_SERVER="smtp://<your-email-smtp-info>"
FROM_EMAIL="investor@tincre.com"
NEXTAUTH_URL=http://localhost:3000
CONVERTKIT_API_URL=https://api.convertkit.com/v3/
CONVERTKIT_API_KEY=<your-api-key>
CONVERTKIT_FORM_ID=<your-form-id>
SAFE_TYPE='Cap' # One of: 'Cap', 'MFN', 'Discount'
Generating secrets

Tincre developers have a custom Python command within their development evironments that calls:

python -c "import secrets; print(secrets.token_hex(64))"

or use openssl, which is probably present in your environment:

openssl rand -hex 64

Tests

Tests leverage jest and Kent Dodd's react testing library. These can be found under the __tests__ directory and run with yarn run test.

Content updates

Make your content changes to the cms.data.js file in the root of this repository. In addition, you'll need to edit siteMetadata.js for proper SEO updating.

ℹ We are upgrading and standardizing the naming conventions so that they may be updated without examining the component codebase. ℹ

Newsletter signup

The Footer component includes a signup for a newsletter through ConvertKit.

Feel free to replace or add to the functionality in pages/api/convertkit.js for additional providers (such as Buttowndown or Mailchip).

Database Infrastructure

We generally use PostgreSQL databases via ORMs at Tincre.

In particular, this site uses Prisma for its database ORM.

Updating tables

To update tables we use Prisma's tools.

Prisma has fantastic documentation https://www.prisma.io/docs/!

Simply add a table via the schema classes in the prisma/schema.prisma file.

Once finished run npx prisma format && npx migrate dev to format/lint the prisma schema and migrate it. Your client will update locally.

Commit the changes from prisma/schema.prisma and the migration file. 💥

⚠️ Production sites will need to be built twice on CI/CD infra, depending on your setup ⚠️.

CRUD Operations

Database functionality lives in the /lib directory. In particular, a global import prisma is in prisma.js.

This contains a prisma object you should use via a default export.

db.js or db.ts

CRUD operations are in the lib/db*{.js|.ts}. In particular, examples of creating, reading, updating, and deleting table objects are extant within this file.

📓 Inline documentation is critical and provided using @jsdoc!

Authentication Infrastructure

Auth is provided out of the box by next-auth. In particular, we use the Prisma Adapter throughout this project.

Client-side Page Authentication

We add authentication to individual pages via the client, which checks for the auth session, validating it via the /api/auth/session backend api function via the useSession hook. This hook is populated by the SessionProvider Higher Order Component within the custom _app.jsx Next App overload.

After successful authentication, the redirected user will have a state session stored in their browser.

Server-side Page Authentication

For server-side rendering and other protected api endpoints, such as /api/, we check for the session to confirm that the header provides the appropriate authentication.

This is handled seamlessly within via the next-auth library.

Providers

Right now we offer the following authentication providers:

  • direct-to-email link,
  • (coming soon) Google Accounts,
  • (coming soon) Github,
  • (coming soon) Gitlab,
  • (coming soon) Microsoft,
  • (coming soon) and Twitter.

We can and will add more at a later date.

Contributions

We ❤️ community contributions.