When I read about frontends, it always mentiones webpages. Can it be used in different contexts, e.g. desktop applications?
The term is generic and it tends to be used in n-tiered applications and refers to the UI.
It is not limited to n-tiered applications - in a single tiered application, if you have good separation of layers (say UI, business logic and infrastructure), you would still refer to the UI as the front-end.
So, you can use it whenever you are specifically talking about the UI - the interface that the end user uses.
The term is used both in design and development, including development of desktop software. The term targets a part of a system which is intended to be accessed by a customer or a user.
1. In web development:
It is not unusual to make the difference between:
Front end: the website or web application itself, as it is used by people outside the company,
Back end: the part of the web application which is used only by people with specific permissions and which allows them to execute administrative tasks.
Note: moderators would be qualified as people outside the company, so controls used by moderators are part of front end.
2. In SOA/SASS:
When services are involved, front end would be everything directly accessible by the users/customers. A desktop application installed by the user and which connects to a bunch of web services would be qualified as front end.
Services themselves, in this context, would be excluded from the front end.
Note: if a web service is the actual product, it may be qualified as a front end. For example, Twilio web service is the front end.
Wikipedia has an article that answers this question directly, front and back ends.
In the context of compilers:
- Front end validates the syntax and semantics then outputs some intermediate representation, such as an AST.
- Back end generates the assembly or translated code.