Skip to content

luumitech/community-db

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

community-db

Community DB Logo

A database for community. Keeping record of household within small community, events, memberships, etc..

Production Site License

Screenshots

Property List Dashboard
Easily search membership information within community Visualize membership information

🛠️ Tech Stack

Category Technology
Framework Next.js
Frontend React
Language TypeScript
Database MongoDB
Authentication Better-Auth
Upload storage uploadthing
Email handling nodemailer
UI Component HeroUI
CSS Processor Tailwind CSS
Animation Motion
Icons Iconify

💻 For Developers

# Create a .env.local file
# Replace the '...' value with appropriate values
cp .env .env.local

# Run the development server
yarn dev

Open http://localhost:3000 with your browser to see the result.

This project uses next/font to automatically optimize and load Inter, a custom Google Font.

To start development server in HTTPS mode and HTTP/2 mode, refer to nginx/README.md. This project uses SSE (Server Sent Events) to perform graphQL subscription, using HTTP/1 would work as well, but with some restrictions.

Setting up mongodb

The mongo DB must be configured with replication set:

  • stop mongo service: brew services stop mongodb-community

  • update mongo config $(brew --prefix)/etc/mongod.conf file with replication props:

    systemLog:
      destination: file
      # Change /opt/homebrew/var to /usr/local/var (if on intel)
      path: /opt/homebrew/var/log/mongodb/mongo.log
      logAppend: true
    storage:
      # Change /opt/homebrew/var to /usr/local/var (if on intel)
      dbPath: /opt/homebrew/var/mongodb
    net:
      bindIp: 127.0.0.1
    replication:
      replSetName: "rs0"
  • start mongo service: brew services start mongodb-community

  • while mongod is running, run mongosh, then:

    rs.initiate({_id: 'rs0', members: [{_id: 0, host: '127.0.0.1:27017'}]});
  • if you need to apply new configuration, then:

    rs.reconfig({_id: 'rs0', members: [{_id: 0, host: '127.0.0.1:27017'}]}, {force:true});

Updating mongo schema

Whenever mongo schema prisma/schema.prisma is modified, you will need to run:

yarn update-prisma-db

Updating landing page screenshots

The screenshots are generated by running the playwright test tests/screenshot/landing.ts. The database is prepared by restoring from __fixtures__/db-screenshot.xlsx. You can optionally reseed the database by uncommentting the line:

  await mongodbSeedRandom(10);

This test is excluded from e2e test run, so it must be manually run to recreate the screenshots.

# On one terminal, start the dev server
yarn dev:playwright
# On another terminal, run the screenshot tests
yarn pw:screenshot

Updating App logo

Many app related logo files are generated via this command:

yarn gen-favicon

Note: The Google OAuth consent screen also make use of the app logo, and should be updated accordingly if this is changed.

Updating Email content

Emails are sent through nodemailer, and the content is defined in src/email/**.ts. The email content is generated using react-email.

To run the email viewer locally:

yarn email-ev

Prerequiste for deploying to Microsoft Azure

In Azure Portal:

  • create Resource Group <group-name>
  • create Container Registry <registry-name>
  • create App Service <app-name>

Install Azure CLI:

brew update
brew install azure-cli

# Sign in to Azure
az login

Building docker image

Build new docker image to Azure container registry

# clone git repository
# On windows box, it's important to keep the CRLF of the repository file
# because files like `docker/entrypoint.sh` need to have LF line ending (not CRLF)
git clone [email protected]:luumitech/community-db.git --config core.autocrlf=input

# To push a new image and tag it as `dev``
# Tagging an image with 'dev' will trigger a webhook to deploy the image into dev slot
./script/azure/build-image.sh --tag=dev

Build new docker image to Docker container registry

# clone git repository
# On windows box, it's important to keep the CRLF of the repository file
# because files like `docker/entrypoint.sh` need to have LF line ending (not CRLF)
git clone [email protected]:luumitech/community-db.git --config core.autocrlf=input

# To push a new image and tag it as `main``
# Tagging an image with 'main' will trigger a webhook to deploy the image into main slot
./script/docker-hub/build-image.sh --tag=main

About

For keeping track of membership data for rate payer association

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages