devhindo / x

post tweets from terminal
https://x-blush.vercel.app
MIT License
27 stars 2 forks source link

App architecture? #49

Open mesb1 opened 1 month ago

mesb1 commented 1 month ago

Hi. Did i get it right, your app isn't directly posting into twitter anything? And you are using some 3rd party for this?

I am asking because when i have checked log of application access - there is no any address related to my server, only some random servers logon approximately at the time of posting messages.

devhindo commented 1 month ago

Yeah, I'm using a Next.js server for handling authentication and posting. It's located in the src/server. The CLI interacts with the server and the server does the necessary validations and interacts with Twitter API. This is due to the new Twitter API specifications, in which every request to the Twitter API should be linked to some Twitter APP. (Mine is X CLI) the one you authenticated to post on your behave when you opened the URL in your browser.

mesb1 commented 1 month ago

I'm using a Next.js server for handling authentication and posting. It's located in the src/server.

Is it safe for us to use it? Is it possible to run it locally also if it will be banned or experiencing connectivity issues?

devhindo commented 1 month ago

Is it safe for us to use it? Is it possible to run it locally also if it will be banned or experiencing connectivity issues?

The whole codebase resides on this repo, both the CLI code and the server. You can check it and suggest enhancements or even open a PR for improving security or its functionality. It's simply an open-source project.

As I said this is the only approach as Twitter's new plan is to attach every request to their API to an APP ID for better monetization. To run it locally you will need to create a Twitter Developer account and initiate a Twitter APP and also deploy the Next.js server somewhere and a DB to save credentials. The server is just a global interface with the Twitter API that has my app secret ID that allows it to interact with the Twitter API. I'm assuming it's fairly safe if it's open source. I can add local hosting information but you would have to deploy 3 ends and also create a Twitter APP. Would you suggest that?

devhindo commented 1 month ago

Is it possible to run it locally also if it will be banned or experiencing connectivity issues?

You can of course deploy it locally with your own Twitter APP ID as I said. But you would need to deploy the Next.js server and deploy a DB but I can't see this is necessary for just one user. Should I add instructions for doing so?

mesb1 commented 1 month ago

Should I add instructions for doing so?

In future yes. As for now as far as i understand your server is a kind of hardcoded inside x app.

devhindo commented 1 month ago

Should I add instructions for doing so?

In future yes. As for now as far as i understand your server is a kind of hardcoded inside x app.

Which x app? the server is separate from the CLI. The CLI only performs GET and POST requests to the server.

mesb1 commented 1 month ago

The CLI only performs GET and POST requests to the server.

yep, that's what i am mean, but the address of server is a hardcoded

devhindo commented 1 month ago

The CLI only performs GET and POST requests to the server.

yep, that's what i am mean, but the address of server is a hardcoded

Should it be located in .env file? Or Where?

mesb1 commented 1 month ago

Should it be located in .env file? Or Where?

it is up to you, personally iam fine with optional arguments

mesb1 commented 1 month ago

Well, because of issue #47 there is a sense to provide some information of how: Add developer acc. Register own app. Run own server. Target xcli to own server.

I assume most hard part is a run own server, as it doesn't looks like standalone app written on GOlang.