Come and create your own anonymous question box!

In the past two years, there have been more and more anonymous questions and answers in the form of question boxes, such as Popi, which is popular in the circle of friends, the anonymous question box popular on Twitter, and the former QQ whispers. The most interesting thing about playing this kind of anonymous social is to guess who the questioner is and the state of mind of the questioner when he asks the question. When readers look at the answer history of the question box, they can quickly establish a preliminary image of the answerer, and then further infer what kind of person the author is.

anonymous?

However, anonymous question and answer, can it really be anonymous? It’s hard! Data and traffic are too important for no one to give up, and even companies that claim to be extremely privacy-conscious will silently collect user page browsing information (such as browsing time, user origin, user IP address, etc.). At the beginning, I didn’t want to collect any information, I hoped to be a completely anonymous question box without any additional information collection, but then I encountered bombarded questions, and I sent dozens of them in a few minutes, which greatly affected the experience, so I think Still have to be limited (because of the need to limit fixed IP bombing).

social regulation?

As we all know, social applications have many restrictions. Individuals basically cannot engage in social applications, especially those who want to be listed on the application market. Any UGC must be reviewed. Moreover, the Internet is mixed, and it is inevitable that there will be script kiddies to bomb small children. website, so deploying on your own server is not particularly secure.

It happens that I have never developed Vercel-related applications, and nextjs is also well-known for a long time. I think it is time to try it out.

Material preparation

Originally, I thought that vercel did not have a supporting database service, and it would be very troublesome to use, so I found a SaaS platform to put the data, so I thought of the LeanCloud that I used before, the well-known blog commenting application Valine is the service provider used, basically It doesn’t cost much, and their documentation is well-written and pretty good. The disadvantage is that some functions require their own domain names, and they must be registered domain names.

Project open source address: https://github.com/TankNee/AnonymousQuestionBox

Before, I also planned to make a branch that uses a local database, so that I can directly deploy to platforms such as railway (I only found out that there is such a platform when I was about to finish writing it).

So we need the following preparations:

  • A LeanCloud account
  • A registered domain name
  • a GitHub account

Deployment steps

First open the LeanCloud platform and create a new application:

1 Create an app

Just choose the free version, which is enough.

Then go to the app’s Settings – App Credentials page to save the credential information:

1

In theory, this temporary server address can be used, but I still recommend using your own domain name.

Then click Data Storage – Structured Data – Create Class

1 Create a structured data class

Here we need to create three classes, namely:

  • Answer: store answer
  • Question: store questions
  • Settings: store some setting information, such as page title

Next we can click < Deploy Now > to deploy the question box on vercel. Environment variables need to be filled in correctly, otherwise an unknown error may be thrown.

  • PORT ( required ): The running port, just fill in 4000 directly.
  • LEANCLOUD_APP_ID ( required ): Fill in the LeanCloud application APP ID information obtained above.
  • LEANCLOUD_APP_KEY ( required ): Fill in the APP KEY information of the LeanCloud application obtained above.
  • LEANCLOUD_SERVER_URL ( required ): Fill in the LeanCloud application server address information obtained above.
  • USER_KEY ( required ): password for question box login, please pay attention to protecting privacy.
  • MAILER_ACCOUNT: SMTP email account (in order to send emails to the owner of the question box, an email account is required).
  • MAILER_PASSWORD: Mailbox password.
  • MAILER_HOST: The domain name of the SMTP service (eg: smtp.163.com ).

After filling in, wait for deployment!

Check out the sample question box:


Admin users can enter the admin page by clicking on the title:

1 enter password!

After successful login, click the title again to exit the management state.

This article is reproduced from: https://sspai.com/post/73783
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment