Sign inSign up

flosspicks/newbie-villa

By flosspicks

•Updated about 1 year ago

Image
0

1.9K

flosspicks/newbie-villa repository overview

⁠Crossbell Newbie Villa Backend Service

Newbie Villa facilitates a smooth transition from Web2 to Web3 on Crossbell. Users can start by registering with their email, automatically receiving a Character for on-chain social interactions. As users delve deeper, they can claim their Characters via a wallet address, unlocking the broader Web3 social realm on Crossbell.

⁠Features

  • Seamless Web3 migration with familiar email authentication.
  • Automatic Character assignment for new registrations.
  • On-chain social interactions recorded, with server covering initial gas fees.
  • Progress to a genuine Web3 social user by claiming your Character with a wallet address.

⁠Getting Started

⁠Install deps:
npm install
⁠Prepare environment variables:
copy .env.example .env
⁠Setup wallet:

You will need to create a wallet and obtain the private key and address, then fill in the environment variables: NEWBIE_VILLA_WALLET_ADDRESS and NEWBIE_VILLA_WALLET_PRIVATE_KEY.

⁠Setup mailer:

Follow mailgun dashboard⁠ to obtain the needed environment variables: MAILGUN_API_KEY and MAILER_USER.

e.g.

MAILGUN_API_KEY=1234567890abcdef1234567890abcdef
[email protected]

Then run the test to check if the mailer is working:

docker run -d -p 6379:6379 redis:alpine # start a redis instance
MAILGUN_API_KEY=1234567890abcdef1234567890abcdef [email protected] [email protected] node -r ts-node/register test/test-mailer.ts
⁠Start Database instance:
npm run docker:db
⁠Migrate database and generate types in development environment:
npm run prisma:migrate:dev
⁠Start server:
npm run start:dev
⁠Access the Swagger API docs:

Once the server starts, the Swagger API docs will be available at the /docs path. For example, if you are running the server locally at port 3987, you can access the docs at http://localhost:3987/docs⁠.

⁠Deployment

Docker:

# building new NestJS docker image
docker-compose build
# or
npm run docker:build

# start docker-compose
docker-compose up -d
# or
npm run docker

In Node.js Environment:

npm install
npm run build
NODE_ENV=production node dist/main
⁠Migrate database

In development:

npm run prisma:migrate:dev

In production:

npm run prisma:migrate:deploy

⁠Customizing Endpoints in Crossbell React Kits⁠

Check out the customizing guide here⁠.

⁠Modules

⁠NewbieJWT⁠

NewbieJWT Module handles the account related features like login, register, reset password, delete account, etc.

⁠NewbieTransaction⁠

NewbieTransaction Module handles the transactions like posting, commenting, liking, tipping, etc.

⁠Mailer⁠

Mailer Module handles the email related features like sending verification email, sending reset password email, etc.

⁠CsbManager⁠

CsbManager Module provides some helper functions for interacting with the $CSB.

⁠Contract⁠

Contract Module used to initialize the contract instance.

⁠Contribute

Feel free to contribute to the Newbie Villa service to help lower the barrier between Web2 and Web3!

🫡 This project was initially developed by @SongKeys⁠. Original commit logs were deleted to protect sensitive information before open-sourcing.

Tag summary

Content type

Image

Digest

sha256:cb46589e8…

Size

584.2 MB

Last updated

about 1 year ago

docker pull flosspicks/newbie-villa